What is the fastest way to send 100,000 HTTP requests in Python?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
The fastest practical way to send a very large number of HTTP requests in Python is usually asynchronous I/O with connection reuse and bounded concurrency. The important word is "practical." Launching 100,000 requests at once is rarely the real optimum, because sockets, DNS, file descriptors, remote rate limits, and server protections become the bottleneck long before Python syntax does.
Prefer Async I/O Over Blocking Loops
A plain requests loop is easy to write, but it sends one request at a time unless you add threads or processes. For a network-bound workload at this scale, asynchronous I/O is a better fit.
With aiohttp, a basic pattern looks like this:
This keeps many requests in flight without blocking a thread per request.
Reuse Connections and Bound Concurrency
The biggest performance wins usually come from:
- reusing one session
- reusing TCP connections
- limiting concurrent requests to a realistic number
Creating a new client or a new TCP connection for every request adds a lot of overhead. The shared ClientSession and connector are not optional optimizations here. They are part of the baseline for high-volume HTTP work.
The semaphore and connector limit matter too. "Fastest" does not mean "infinite concurrency." It means pushing the pipeline as hard as the network, the remote server, and your machine can actually sustain.
Threads Are Simpler but Usually Not the Best at This Scale
A thread pool can still help if you want an easier mental model:
This is often fine for moderate concurrency, but for 100,000 requests, async clients usually scale better because they avoid the overhead of large thread pools for a mostly I/O-bound problem.
Throughput Depends on the Whole System
The real bottleneck may be:
- remote rate limiting
- server-side throttling
- DNS lookup cost
- local open-file limits
- bandwidth and latency
That is why benchmarking against the actual target service matters more than arguing over libraries in the abstract. A client that is "fastest" against localhost may fail badly against a real API that enforces connection limits or retry headers.
At high scale, you may also need:
- backoff and retries
- request batching where the API supports it
- multiple source machines
Sometimes the fastest way to complete 100,000 logical operations is not 100,000 separate HTTP requests at all.
Common Pitfalls
- Launching far more concurrent requests than the operating system or remote service can handle.
- Creating a new HTTP client or session per request instead of reusing one session.
- Measuring only client-side dispatch speed and ignoring server throttling or failures.
- Assuming threads and async are interchangeable at very high request counts.
- Forgetting timeouts, retries, and backpressure, which makes the "fast" solution collapse under real network conditions.
Summary
- For very high request volume in Python, async I/O with
aiohttpor a similar client is usually the fastest practical approach. - Reuse one session and limit concurrency instead of firing everything at once.
- Connection pooling matters as much as syntax choice.
- The true limit is often the network, the OS, or the remote server, not Python itself.
- Benchmark against the real target and tune concurrency deliberately rather than chasing raw request counts blindly.
Related reading
- What is the konnectivity service for Kubernetes?
- What is the meaning of the CascadeType.ALL for a @ManyToOne JPA association
- What is the overhead for creating multiple ZeroMQ sockets?
- What is the Python 3 equivalent of python -m SimpleHTTPServer
- What is the fastest way to transpose a matrix in C?
- What is the intended use of the optional else clause of the try statement in Python?
- What is the global interpreter lock GIL in CPython?
- What is the intended use of the optional else clause of the try statement in Python?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.