Recommended sites

Add to MyYahoo!
Subscribe in NewsGator Online
Add to Newsburst
Add to Google
Add to My AOL
Add to Pluck
Subscribe in FeedLounge
Add to Windows Live
Add to NetVibes
Subscribe in Rojo
Subscribe in Bloglines
Add to MyMSN
Add to Plusmo for your cellphone
Add to PageFlakes
Add to Technorati
Add to BlinkBits
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.


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 ( Sunday, 25 February 2007 23:07 )
 


Another articles:


Content View Hits : 2418395

Enter Amount: