Concurrent connections are the number of client connections a server holds open at the same instant, whether those connections are actively transferring data, waiting for a request or idling under keep-alive. In Server performance work on servers, the figure describes simultaneous occupancy of server resources, which makes it a different measure from throughput or requests per second.
Every open connection consumes a file descriptor, kernel socket buffers, some application memory and, depending on the server architecture, a thread, a process or an entry in an event loop. The ceiling on concurrent connections is therefore set by whichever of these resources runs out first, and planning capacity means knowing which one that is.
How concurrent connections occupy server resources
A connection exists from the TCP three-way handshake until one side closes it, and the server must keep state for the whole of that lifetime. On a typical Linux host the kernel stores each socket with its send and receive buffers, which commonly range from a few kilobytes to several megabytes per socket when autotuning is active.
Above the kernel, the application decides how expensive a connection is. A thread-per-connection model dedicates a thread with its own stack to each client, while an event-driven model multiplexes thousands of sockets through readiness notification such as epoll on Linux or kqueue on BSD systems. The difference explains why the C10k problem was solved by changing architecture rather than by adding hardware.
The following table lists the resources that each open connection consumes and the usual limit that caps them.
| Resource | Typical cost per connection | Limiting setting |
|---|---|---|
| File descriptor | One descriptor | ulimit -n, fs.file-max |
| Kernel socket buffers | Several KB to several MB | net.ipv4.tcp_rmem, tcp_wmem |
| Worker thread or process | 256 KB to 8 MB of stack | Worker pool size |
| TLS session state | Tens of KB | Available memory |
| Ephemeral port (outbound) | One port per destination tuple | ip_local_port_range |
Concurrent connections versus throughput and response time
Concurrency, throughput and latency are linked by Little’s law, which states that the average number of items in a system equals the arrival rate multiplied by the average time each item spends there. A server receiving 2,000 requests per second with an average response time of 50 ms therefore holds about 100 requests in flight at any moment.
Open connections usually exceed requests in flight, because HTTP keep-alive leaves idle connections open between requests. A site can show 20,000 concurrent connections while only a few hundred requests are being processed, and confusing the two numbers leads to badly sized worker pools.
The table below separates the related metrics that are often mixed up in capacity discussions.
| Metric | What it measures | Typical unit |
|---|---|---|
| Concurrent connections | Sockets open at one instant | Count |
| Requests in flight | Requests being processed now | Count |
| Requests per second | Completed requests over time | Requests per second |
| Throughput | Data or work delivered over time | Mbit/s or transactions per second |
| Response time | Duration of one request | Milliseconds |
Server architectures and their connection ceilings
The architecture of the server software is the largest single factor in how many concurrent connections a host can sustain. Process-based and thread-based servers hit memory limits early, whereas asynchronous event loops keep idle connections cheap and shift the limit toward file descriptors and kernel memory.
A proxy layer changes the picture again. Placing an event-driven reverse proxy in front of a PHP worker pool lets the proxy absorb tens of thousands of slow or idle client connections while passing only active requests to a small, fixed number of workers.
This table compares common connection handling models and the ranges they reach on ordinary hardware; actual results depend on memory, request mix and tuning.
| Model | Example | Practical concurrency range | Main constraint |
|---|---|---|---|
| Process per connection | Apache prefork | Hundreds | Memory per process |
| Thread per connection | Classic Java servlet containers | Hundreds to low thousands | Thread stacks and context switching |
| Event loop | Nginx, Node.js, HAProxy | Tens of thousands to millions | File descriptors and kernel memory |
| Hybrid event plus workers | Apache event MPM, PHP-FPM behind a proxy | Thousands at the edge | Size of the backend pool |
Tuning and measuring concurrent connections
Raising the connection ceiling starts with the operating system. Administrators commonly increase the open file limit to 65,535 or higher, enlarge the listen backlog through net.core.somaxconn, and widen the ephemeral port range on hosts that open many outbound connections to upstream services.
Measurement should come from the server itself rather than from assumptions. Tools such as ss -s report socket states, web server status modules expose active, reading, writing and waiting counts, and load generators such as Apache JMeter or k6 model concurrency with virtual users. A test should increase concurrency in steps and record where tail latency starts to climb sharply.
The decision table below matches common situations with a recommended adjustment.
| Situation | Recommended action | Reason |
|---|---|---|
| Errors about too many open files | Raise ulimit -n and the service file limit | Descriptors are exhausted before memory |
| Many idle keep-alive sockets | Shorten the keep-alive timeout | Frees descriptors held by idle clients |
| Backend workers all busy | Queue at the proxy, tune the pool size | Prevents resource saturation in the backend |
| Connection resets under bursts | Increase the listen backlog | Absorbs short arrival spikes |
| Ephemeral port exhaustion | Reuse upstream connections | Avoids churning TIME_WAIT sockets |
Limitations and common mistakes
A high connection count is not a goal in itself. Accepting more connections than the backend can serve only moves the bottleneck into a queue, where requests wait and response times grow without any gain in completed work.
- Treating maximum concurrent connections as a measure of speed, when it only measures how many clients can wait at once.
- Sizing a worker pool from total open connections instead of requests in flight.
- Ignoring slow clients and slowloris-style attacks, which hold connections open with minimal traffic to exhaust limits.
- Testing with a few clients that reuse connections and concluding that production traffic, with many short-lived connections and TLS handshakes, will behave the same.
- Raising limits without checking memory, which can trigger the out-of-memory killer under peak load.
A plain-language summary
Think of a server as a restaurant. Concurrent connections are the number of tables occupied right now, whether the guests are eating, ordering or just sitting with an empty glass. Each table takes space and some attention from the staff, even when nothing is happening at it.
A restaurant can fill every table and still serve food slowly if the kitchen is too small. Servers work the same way: many open connections do not mean fast service. What matters is having enough room for guests and enough cooks for the orders that are actually being prepared.
An example from practice
An online retailer prepares for a seasonal sale on a server running Apache with the prefork model and PHP. During the previous sale the site stopped responding at roughly 400 concurrent connections, because each Apache process used about 60 MB of memory and the 32 GB host ran out of room. Most of those processes were simply holding idle keep-alive connections.
The operations team places Nginx in front as a reverse proxy, moves PHP to a pool of 80 PHP-FPM workers and raises the open file limit to 100,000. A k6 test with stepped virtual users shows the proxy holding about 25,000 concurrent connections while the workers process roughly 1,500 requests per second. During the sale, the 95th percentile response time stays under 300 ms, and memory use remains below half of the available capacity.