Apache 2.2 optimization -> Three tips

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's three things I wish I had read about Apache optimization that are not
commonly discussed (we found out by years of trial and error).  These three
settings are worth more than all the other optimization we've done (e.g.
SendBufferSize, AcceptFilter http data, EnableMMAP On, EnableSendfile On,
eliminating all .htaccess files, etc.)

1. Set your KeepAliveTimeout to 3 seconds or less.

2. Turn off atime "accesss time" by using noatime.  Do it in real time with
*something like* the command line below.  This will make it so you only have
to read the file off the disk instead of doing both a read (to get the data)
then a write to update the access time.

shell> mount -o noatime,remount,rw / 

To make the noatime setting last between reboots edit your fstab and modify
this line:
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
To read *something like* to like this:
/dev/VolGroup00/LogVol00 /                       ext3    defaults,noatime
1 1

3. Increase your StartServers to the number of maximum requests on your
biggest page.  For example, if your busiest page requires 30 hits/requests
to load all the images, css, javascript, etc then if you have the RAM to
support it, set your StartServers to 30 and your MinSpareServers to 30.  To
know if you have the RAM to support it, run the command "top" and look for
the httpd process under the column "RES."  That's the amount of physical RAM
the Apache process is taking up.  On our server, each process take up about
12 megs of RAM.  So having 30 Apache process running will takes up 360 megs
of RAM.  Now use Firefox Firebug.  Look at the time each item is in
"waiting."  Before you increased  StartServers you might see the first 10 or
20 items have a "waiting" time of 20 to 30 ms then the last 10 items have a
"waiting" time of 300 or 500ms or more.  When you have enough processes
going, all the "waiting" times will be about the same.  Don't raise your
StartServers above the amount of RAM available otherwise you'll swap which
I've read is very slow (you can tell by looking at the "top" output under
the row called "swap").

Money and premature optimization is the root of all evil.

Best,

http://www.t1shopper.com/


-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
"The nine most terrifying words in the English language are: I'm from the
government and I'm here to help." - Ronald Reagan, August 21, 1986
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux