Skip to content

2k33cse992574/Concurrent-Rate-Limited-Worker-Pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 

Repository files navigation

Concurrent Rate-Limited Worker Pool

This project demonstrates a highly robust, multi-threaded worker pool utilizing Python's ThreadPoolExecutor. It features a custom Token-Bucket Rate Limiter and safely handles shared state without lost-update race conditions.

๐Ÿš€ Overview

Concurrent Rate-Limited Worker Pool | Python, ThreadPoolExecutor, Threading

  • Built a multi-threaded worker pool with a custom token-bucket rate limiter using Semaphores and a background refill thread, enforcing a strict global request rate across concurrent workers without burst overruns.
  • Implemented Lock-protected shared state to safely aggregate results across threads, preventing lost-update race conditions on shared counters under simulated partial failures.

โš™๏ธ Key Features

  • Token-Bucket Rate Limiter: A background thread refills tokens at a fixed rate, ensuring strict API request limits are not exceeded globally across the entire pool.
  • Race Condition Prevention: Uses threading.Lock to guarantee atomic increments on state aggregation.
  • Simulated External API: Simulates network latency and partial failures.
  • Concurrency: Scales out processing utilizing Python's ThreadPoolExecutor.

๐Ÿ’ป Running the Project

# Clone the repository
git clone https://github.com/YourUsername/concurrent-worker-pool.git
cd concurrent-worker-pool

# Run the pool execution simulation
python worker_pool.py

This project is designed to showcase advanced backend engineering capabilities with concurrent Python environments.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages