Speed up your apache server running PHP Print E-mail
User Rating: / 0
PoorBest 
Sunday, 25 February 2007 22:56

Since I am facing performance problem due to the load of visitors and a badly configured server, I decide today to document my findings in this new series of articles.

As soon as PHP run as FastCGI and no more inside an Apache module (mod_php4.so is not multi threaded), You should be able to switch the default MPM setting of Apache from MPM prefork to MPM worker.

So, what's the difference between prefork and worker?

Quoting from the Apache MPM Prefork page: http://httpd.apache.org/docs/2.0/mod/prefork.html
MPM Prefork implements a non-threaded, pre-forking web server that handles requests in a manner similar to Apache 1.3.

And for the Apache MPM Worker says: http://httpd.apache.org/docs/2.0/mod/worker.html
MPM Worker implements a hybrid multi-process multi-threaded server. By using threads to serve requests, it is able to serve a large number of requests with less system resources than a process-based server.


Server: Strato (www.strato.de)
Operating system: SuSE / openSuSE
Requirements: root access and basic Unix knowledge

1 Edit the file  
# vi /etc/sysconfig/apache2

and change the key:

APACHE_MPM=" "


to

APACHE_MPM="worker"


2 You can now tune also  default parameters in file /etc/apache2/server-tuning.conf
Here are my settings, these are still the default setting of Apache

vi /etc/apache2/server-tuning.conf

# worker MPM

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




3 start
# apache2-reconfigure-mpm
this recreate the file  /etc/apache2/sysconfig.d/loadmodule.conf
and restart apache automatically. Test Your site to ensure everything still work as expected.


Tags See All Tags Add New Tag...

Please Enter New Tags Separated By Comma's
  Or Close

apache  morespeed  php 
Powered By Joomla Tags

Comments
Add New Search RSS
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
:):grin;)8):p:roll:eek:upset:zzz:sigh:?:cry
:(:x
Please input the anti-spam code that you can read in the image.

3.20 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Sunday, 25 February 2007 23:07
 


Another articles:

Powered By relatedArticle

Content View Hits : 3455176

Enter Amount: