Stop increasing max_connections every time there’s a 1040: Too Many Connections error. Every additional connection is another share to further divide the available memory.
Instead, while it would be best to manage the workload, it is also reasonable to properly utilize the available hardware with good server configuration.
There are three relevant server configuration options for managing connection counts as they relate to satisfying web requests.
- max_connections – the queue depth
- innodb_thread_concurrency – the count of queue consumers
- innodb_concurrency_tickets – the amount of work a consumer can do on a query before switching to the next query request
Correctly configuring these three variables, and controlling your workload of course, can prevent 1040 Too many connections errors, assuming, …
[Read more]