Tune a Linux server to handle 100,000 concurrent connections.
AdvancedScenarioPerformance, MTU, Latency & Tools
Answer
Situation read → Think file descriptors, kernel buffers and the accept queue.
What I'd do →
- Raise limits:
ulimit -n 1048576andfs.file-max - Tune the accept queue:
net.core.somaxconn=65535andnet.ipv4.tcp_max_syn_backlog=65535 - Widen ports and enable
tcp_syncookies - Set
net.core.netdev_max_backlog, use multi-queue NICs and RSS/RPS for CPU spread - Use epoll-based servers (Nginx, Envoy)
- Verify with
wrkork6while watchingss -s
Why → Each connection costs memory and a descriptor; the defaults assume far lower scale.
Interview tip → Say you measure after every change, not guess.
More on Performance, MTU, Latency & Tools
Latency, bandwidth and throughput: what is the difference and why does it matter?BeginnerWhen do you use ping, traceroute and mtr?BeginnerWhat is MTU and what is the usual value?BeginnerHow do you check what is listening on a port and who is connected?BeginnerHow do you measure where time goes in a slow HTTP request?BeginnerWhat does tcpdump do and what are the first filters you use?Beginner