ATG: Tuning Apache + Tomcat
I did some tuning on Apache which vastly decreased response times.
The tests show increase vast decrease in response. (see table below) which is due to the following improvements made effective by the tuning (Increased maxclients, KeepAlive on. KeepAliveTimeout etc):
1) Reusable connections to handle multiple requests from the same client, which in return causes less connections from client to the web-server and decreases response times.
2) Because of Point 1, apache now needs less Httpd clients to server more load, hence decrease in resource usage (Memory).
4) MaxClients has been increased to 1000, hence if required apache can now expand to serve more load without the queue buildup which causes high latencies.
|Request||100||100 (Tuned)||Perf gain (%)||400||400(Tuned)||Perf gain (%)|
The changes will require the following changes in the HTTP.cong (/etc/httpd/conf/httpd.conf)
Note: the above improves performance but exausts mod_jk thread pools, as the response are shorter now, hence more load.
Read the following on MPMs to fine tune it further:
Choosing an MPM
Apache 2.x supports pluggable concurrency models, called Multi-Processing Modules (MPMs). When building Apache, you must choose an MPM to use. There are platform-specific MPMs for some platforms:
mpm_winnt. For general Unix-type systems, there are several MPMs from which to choose. The choice of MPM can affect the speed and scalability of the httpd:
workerMPM uses multiple child processes with many threads each. Each thread handles one connection at a time. Worker generally is a good choice for high-traffic servers because it has a smaller memory footprint than the prefork MPM.
preforkMPM uses multiple child processes with one thread each. Each process handles one connection at a time. On many systems, prefork is comparable in speed to worker, but it uses more memory. Prefork’s threadless design has advantages over worker in some situations: it can be used with non-thread-safe third-party modules, and it is easier to debug on platforms with poor thread debugging support.
For more information on these and other MPMs, please see the MPM documentation.