Every JavaScript developer has written it: an array of URLs, a map to fetch, one Promise.all around the result. On twenty items the pattern is harmless. On a customer export of ten thousand rows it becomes a self-inflicted outage, and the crash lands in the API you were calling, minutes after your code looked completely correct.
The trending query Stop Wrapping Everything in Promise.all: How Unbounded Concurrency Crashes APIs trended on dev.to in late November 2026, and the lesson outlives any single runtime. Fire ten thousand requests at once and the failure is yours, designed in at the line where the loop was written. The fix is a boring engineering idea with a great name, backpressure.
What Promise.all actually does
Promise.all takes a list of already-started promises and waits for all of them. The starting is the trap: passing it the result of urls.map(fetch) means every request fires the moment the map runs. The list length becomes the concurrency level, whatever that length happens to be.
The resources underneath are finite. Sockets, file handles, and server capacity all run out, and the failure pattern compounds: timeouts stack up, automatic retries add a second wave, and the target API slows or refuses connections for everyone, its other users included. The stampede even has a name, a thundering herd.
Backpressure gives the loop brakes
Backpressure means matching your output rate to the capacity downstream. In code that is either fixed-size batches, one hundred at a time with a wait between waves, or a worker pool where N functions pull from a shared queue. Ten concurrent workers make ten requests at any instant, no matter how long the list is. The same switch tames retry storms, because a bounded pool naturally spaces its attempts.
Bounded queues also make failure informative. When the queue is full you can slow down, retry later, or reject with a clear message, and each option keeps the system in a state where the next decision is still yours. A thundering herd offers no such choice, because every request is already in flight.
| Approach | Peak concurrency | Behavior under load |
|---|---|---|
| Promise.all over the full list | List length | Exhaustion, timeouts, herd |
| Fixed-size batches | Batch size per wave | Steady, easy to reason about |
| Worker pool | N at any instant | Smooth pacing under varying latency |
| Bounded queue | Bounded backlog | Slows, retries, or rejects with clear errors |
Drop in your PDF - it doesn't leave your device.
Every miss becomes a red node on your map.
Free plan: 21 nodes, no card, no countdown.
One pattern, many names
Database connection pools are backpressure with a different label: twenty connections at most, and everyone else waits. Rate limiters apply the same idea outward. Worker pools in job systems and semaphore counts in download managers repeat it again; the numbers change and the mechanism holds. The knob in every one of these systems is a maximum count, and the setting for unlimited simply does not exist.
The pattern is universal because shared resources degrade the same way everywhere. Capacity is a number, demand beyond it turns into queuing whether you planned the queue or had it thrust on you, and systems that queue deliberately stay up while systems that stampede fall over together.
Key takeaways
- Promise.all starts every promise immediately, so concurrency equals list length.
- 10,000 simultaneous fetches exhaust sockets, file handles, and server capacity.
- Backpressure matches output rate to capacity through fixed batches or an N-worker pool.
- Bounded queues turn overload into a choice: slow down, retry, or reject with a clear error.
- Connection pools, rate limiters, and worker pools are one pattern wearing different names.
Quick answers
Why does Promise.all crash APIs?
It launches the entire list at once, and the target server runs out of sockets and capacity.
What is backpressure?
Matching your request rate to downstream capacity, using batches or a fixed number of workers.
How large should a worker pool be?
Small enough that the target serves every request well; start with a handful of workers and watch error rates.
Does batching cost throughput?
It trades some peak speed for staying up, which is the better trade once lists grow.
Does Promise.allSettled fix this?
No. It changes how failures are collected, and it still starts everything at once.
One thing to do tonight
Find one Promise.all in your own code and wrap it in a pool of five workers. The change is a few lines, and the first time it carries a traffic spike without a page of timeouts, it will become permanent.