sysown / proxysql

High-performance MySQL proxy with a GPL license.
http://www.proxysql.com
GNU General Public License v3.0
5.99k stars 976 forks source link

What is the correct number for mysql-threads #4732

Open chanakagl opened 1 day ago

chanakagl commented 1 day ago

I have six ProxySQL instances running with 8 CPUs each and mysql-threads=24. However, under high traffic, the proxies are still only using a maximum of 50% CPU, which causes latency on the application side. Adding more proxies stabilizes the application and improves performance. I tried increasing mysql-threads beyond 24, but it didn’t make any noticeable impact.

renecannao commented 1 day ago

First hypothesis: You probably have available only 50% of the CPU core you think you have available. If you are running in a cloud environment, the guest OS might think it has access to all N vCPUs, but the underlying virtualization layer and resource management mechanisms enforced by the cloud provider are ultimately controlling the actual CPU allocation and utilization. The 50% limit is almost certainly a deliberate constraint set at the VM or account level.

Another hypothesis: Assuming that ProxySQL is mostly spending time in performing network activities, it is also possible that you are hitting a bottleneck that is not CPU, but network. It could be hitting bandwidth limits, packets limits, or a variety of limits in handling network related interrupts.

My first recommendation is to profile CPU utilization, and then investigate possible bottleneck.

But this issue is unlikely related to ProxySQL's mysql-threads configuration