Generally, according to some methods provided on the Internet, there is no major problem in connecting Apache and multiple Tomcat servers through JK for Cluster load, however, when the traffic volume increases significantly and the peak duration is longer, some default configurations are insufficient.
Today, I personally experienced this process. The maximum number of connections of Apache is 4500, but it is not enough. It will soon be full. The pressure on Tomcat is not great. At the same time, it is found that there are many such error records in mod_jk.log:
(Tomcat) Tomcat is down or refused connection. no response has been sent to the client (yet) or connecting to backend failed. tomcat is probably not started or is listening on the wrong port (errno = 111)
Google checks to find out that the connectiontimeout parameters of Apache and tomcat are not synchronized. By default, JK does not time out, that is, persistent connections, the default Tomcat duration is 500 ms, so the timeout time does not match. As a result, JK repeatedly reconnects to Tomcat, and all of them are blocked at the Tomcat end.
Optimization Method: Add the following configuration in the connector section of Tomcat:
Connectiontimeout = "200000" maxthreads = "2000" acceptcount = "500"
This problem can be solved, and the number of Apache connections will be reduced in a moment.
It's too late to record it here first, so you have time to analyze it.