Wednesday, December 28, 2005

Notes on Apache tuning

Some random personal notes:

  • Enable the following in php.ini because even your server generates the file quickly, it may still take a lot of time for a user behind a slow connection
    output_handler = ob_gzhandler
  • No matter what you do with PHP, PHP files are still served slower than static HTML files
  • Pass objects and arrays by reference when dealing with functions (PHP 4+)
  • Use ps and top to determine the size of Average Apache process. Then divide this by the total amount of RAM to figure out how many MaxClients you should have.
    To see every process on the system using standard syntax:
    ps -e
    To see every process on the system using BSD syntax:
    ps ax
    To see every process except those running as root (real & effective ID)
    ps -U root -u root -N
    To see every process with a user-defined format:
    ps -eo pid,tt,user,fname,tmout,f,wchan
    Odd display with AIX field descriptors:
    ps -o "%u : %U : %p : %a"
    Print only the process IDs of syslogd:
    ps -C syslogd -o pid=

More Information and References