Optimize Apache server

Time4VPS support department receives a lot of questions about how to optimize apache service. This article introduces basic, simple and yet effective ways to optimize apache service according to VPS resources. By default, apache "prefork" module is used. When this module is in use, one process serves one query. Those processes must be defined in strict numerical values to avoid VPS resource allocation to apache only.

For traditional apache optimization, there are four variables used by apache:

• StartServers: number of child server processes created at startup;
• MinSpareServers: minimum number of idle child server processes;
• MaxSpareServers: maximum number of idle child server processes;
• MaxClients: maximum number of connections that will be processed simultaneously.

We can calculate optimal values for those variables:

• StartServers: RAM/128;
• MinSpareServers: RAM/256;
• MaxSpareServers: RAM/64;
• MaxClients: RAM/32.
• RAM: your server total Random Access Memory value;

Practical example in VPS plan with 4 GHz CPU | 4 GB RAM | 50 GB storage | 4 TB bandwidth:

• StartServers: 4096/128=32
• MinSpareServers: 4096/256=16
• MaxSpareServers: 4096/64=64
• MaxClients: 4096/32=128
• Variables must be set in apache server configuration file. To edit this file, execute the following command:

nano /etc/httpd/conf/httpd.conf

Find variables described above and change them according to the formula. After modification, do not forget to restart apache server:

service httpd restart
Sign In or Register to comment.
© 2013 - 2018 Time4VPS. All rights reserved. Powered by Vanilla
The opinions or views of users on the forum are those of the author and not of Time4VPS.