APACHE TUNING

APACHE PERFORMANCE MONITORING & TUNING

  

MPM – Multi Process Module

 

Types of MPM: -

               1) prefork [static] [DEFAULT]

               2) worker [static]

               3) per child

(We can see this module with following command. i.e. “# httpd -M”)

(At a time only one static module is loaded i.e. “prefork” or “worker”)

 

Go to configuration file and search for “prefork” or “worker”

# vim /etc/httpd/conf/httpd.conf

<FOR PREFORK>

               <IfModule prefork.c>

                              StartServers                                 8

                              MinSpareServers                       5

                              MaxSpareServers                       20

                              ServerLimit                                  256

                              MaxClients                                    256

                              MaxRequestPerChild               4000

               </IfModule>

Here,

               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

               ServerLimit: Maximum value for MaxClients for the lifetime of the server

               MaxClients: Maximum number of server processes allowed to start

               MaxRequestPerChild: Maximum number of requests a server process serves

 

<FOR WORKER>

               <IfModule worker.c>

                              StartServers                                 4

                              MaxClients                                    300

                              MinSpareThreads                      25

                              MaxSpareThreads                     75

                              ThreadsPerChild                        25

                              MaxRequestPerChild               0

               </IfModule>

Here,

               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

               MaxRequestPerChild: Maximum number of requests a server process server

 

 

PREFORK V/S WORKER 

1) In PREFORK, each request will serve by each specific process.

     In WORKER, a single process can handle multiple requests.

 

2) In PREFORK, Memory Utilization will be high.

     In WORKER, CPU Utilization will be high.

 

PREFORK – Used when you have GOOD RAM

WORKER – Used when you have GOOD MULTITHREADING CPU

Comments