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