I'm running a traffic intense site plenty of dynamic content, mostly user-generated.
The server is a dedicated one and has a total of 4 Intel(R) Xeon(R) CPU X3210 @ 2.13GHz proccesors. I need to know to optimal values for ServerLimit and MaxClients apache's directives, considering that the server has 4GB of RAM and the MySQL database runs on a separate server. The panel is DirectAdmin with CentOS.
Below are my current directives, but during peak hours with over 5k users, an important lag is noticed - and it's not entirey MySQL's fault, because pages seem to be generated fast (I implemented a page generation time counter), but there is a long connection delay until the page starts responding and is sent to the browser.
<IfModule prefork.c>
StartServers 800
MinSpareServers 20
MaxSpareServers 60
ServerLimit 900
MaxClients 900
MaxRequestsPerChild 2000
</IfModule>
Timeout 90
KeepAlive On
KeepAliveTimeout 5
I should mention that monitoring the server using the top command, CPU usage never goes beyond 20% ~ 30% on peak hour. The MySQL server also has a 30~50% usage at that time, and I'm constantly working on fixing slow queries, but that's a different issue. I know it's not a DB bottleneck because static pages also take long to load on peak hours.
Any tips to optimize these values will be greatly appreciated, thanks.