Optimize Apache For WordPress – High Traffic WebsitesThis article will help you to tweak your apache server and can aceept high traffic, but let’s talk about the insides and possibilities first. Optimizing apache matters the server hardware so if you checking the solution for Shared Hosting then this article won’t help you, should check my other articles for the low traffic website optimization.
Practically it’s seen that many people finding solution for optimizing wordpress but didn’t check the requirement to do so. If you have traffic more than 1M/Month and VPS has Memory of 2GB with 2 Cores CPU and running WHM then it’s complicated to switch to more traffic, since WHM is not made to accept high traffic due to buffer delay between CPU Cores, Memory, Mysql Database & HTTP Server. Usually stat shows how much traffic your WHM can manage with specific hardware requirement and how much you can tweak to accept more traffic. The stat is based on overall monthly traffic (Including all Hosted sites on your WHM)
|Traffic||Memory (GB)||CPU Cores||Tweak Possible Traffic|
|25K to 50K||2||2||75K|
|1M to 2M||4||4||3M|
|3M to 5M||8||8||6M|
|7M to 10M||12||12||11.5M|
|12M to 15M||16||16||17M|
* Database Size matters, with above figure Database Size not calculated.
* More than 17M – You should better switch to Dedicated
To tweak for more traffic find this line in your apache, the following config is default with WHM you can edit the nos according to your CPU Cores & Memory. I assume that you might have 2GB Memory and 2 CPU Cores and the apache httpd.conf may have following values.
You could find the file at the following destination /usr/local/apache/conf/httpd.conf
Note: You might found blank entries between and you can add following lines between tag and change as per your requirement.
StartServers 3 (Change it as per your CPU Cores)
MinSpareServers 3 (Change it as per your CPU Cores)
MaxSpareServers 10 (Do not change)
ServerLimit 50 (Control the maximum value for MaxClients)
MaxClients 50 (Limit on the number of simultaneous requests)
MaxRequestsPerChild 2000 (Number of requests a child server OR each Domain will handle)
Also Find Following & Change OR if not mentioned in your httpd.cof then add them
(If you leave KeepAlive turned on you should change the default KeepAliveTimeout value. This prevents unused connections from staying open for excessive amounts of time.)
(If you leave KeepAlive on you should increase MaxKeepAliveRequests. Setting this higher allows more requests per connection and increases the performance and stability)
Once changes done. Restart the HTTP Server (Recommended Restart Server), to changes take affect.