Can MySQL Handle 100,000 Concurrent Connections? A Real‑World Test
This article details a comprehensive experiment that evaluates MySQL's ability to sustain up to 100,000 simultaneous connections using Percona Server's thread‑pool plugin, sysbench clients, adjusted OS/network limits, and multiple IP addresses, presenting hardware specs, configuration steps, observed errors, performance metrics, and practical recommendations.
Background
Modern short‑video and live‑streaming apps can attract millions of concurrent users, creating massive interaction and high request rates. Relying solely on a traditional database is insufficient, so the author conducts a practical test to determine how far MySQL can scale under extreme connection loads.
Test Environment
Bare‑metal server instance: c2.medium.x86
Physical core @ 2.2 GHz (1 × AMD EPYC 7401P)
64 GB ECC RAM
INTEL® SSD DC S4500, 480 GB (server‑grade SATA SSD)
The setup uses five hosts: one MySQL server and four client machines. The MySQL server runs Percona Server for MySQL 8.0.13‑4 with the thread‑pool plugin enabled, allowing thousands of connections. Clients use sysbench 0.5 (instead of 1.0.x) to generate load.
Network and System Configuration
Network settings are applied via an Ansible playbook (shown in the original image). Systemd limits and ulimit -n are increased to accommodate a large number of file descriptors. The my.cnf file is modified to enable the thread‑pool feature by adding the configuration from server/8.0/performance/threadpool.html and then restarting the Percona server.
Observations
With 25,000 connections, throughput remains stable, but response time improves dramatically from 3690 ms to 979 ms thanks to the thread pool. At 50,000 connections MySQL reports error 99 (cannot allocate request address) because the OS limits available ports to about 28,231 per IP. To exceed roughly 60 k connections per IP, additional IP addresses are required. Sysbench 0.5 can allocate up to 32,351 connections; version 1.0.x hits memory limits much earlier (around 4 k connections).
Scaling Experiments
Two servers each running 25,000 threads achieve 50,000 connections. Adding a third server reaches 75,000 connections, and a fourth server enables 100,000 connections. Throughput stays around 32 k tps, but 95 % latency grows (e.g., 3405 ms for 100 k connections) because the number of concurrent connections doubles. Nevertheless, the thread‑pool configuration still yields lower latency than a non‑thread‑pool setup at comparable loads.
Conclusion & Recommendations
MySQL can indeed support 100,000 concurrent connections when the following conditions are met:
Enable Percona Server's thread‑pool plugin.
Adjust OS and network limits (file descriptors, port ranges).
Assign multiple IP addresses to the MySQL server (approximately 60 k connections per IP).
These three components together allow the database to handle extreme concurrency while maintaining acceptable response times.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
