Forum Moderators: phranque

Message Too Old, No Replies

Apache Tuning with MaxClients

httpd directive for better performance

         

zorde

4:21 am on Feb 25, 2011 (gmt 0)

10+ Year Member



My httpd.conf file has:



# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
MaxClients 150
MaxRequestsPerChild 1000
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>


This has never been changed from the default install.

there are 2 modules (prefork and worker), from reading online it seems you have to chose one.

I have a LAMP server with:
Dual P4 3.06 GHZ XEON CPU
1Gb DDR Ram

Process memory usage shows
19 apache processes using between 25MB - 36MB each
12 mysql processes using 74MB each

What changes should I make to the prefork or worker directives above to get the best performance?

lammert

12:19 pm on Feb 27, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I wouldn't change anything on the Apache side yet, but first look at the MySQL side. 12 processes of 74MB each eats almost all of your available 1GB RAM. You should either tune MySQL to become less RAM hungry, or add more memory to allow both Apache and MySQL to use their share of the available memory. What is the amount of allocated swap space at the moment?

The command free -m should give you some basic information about memory usage.

zorde

3:19 am on Mar 9, 2011 (gmt 0)

10+ Year Member



Thank you for pointing me to Mysql. It led me down the path of tuning where the issues lie.

For anyone reading this thread in the future due to poor performance. try search for info on mysql query_cache and php memcached.
Both are extremely good at giving you massive performance gains under the right conditions.

lammert

9:20 am on Mar 9, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am glad to hear you were able to solve your performance issues.