Apache + Tomcat load tuning record

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.