LAMP Optimization Tips

Below are couple of good points about LAMP optimization. I have figured that out after doing some googling and reading some PDF..

Disable unwanted Apache Modules:

  • Disable all the apache modules like perl,python,proxy etc except php,mysql which are required for your application.
  • Enable only mod_php and mod_rewrite
  • Disable everything else (java, python)

Tune MaxClients

  • Too low: you can’t serve a traffic spike
  • Too high: your memory cannot keep up with the load, and you start swapping (server dies!)

KeepAlive

  • 5 to 10 seconds
  • More than that, it ties up procesess

AllowOverrides

  • You can set to None and move Drupal’s .htaccess contents to vhosts
  • Less filesystem accesses
  • mod_gzip/mod_deflate

Compromise of CPU usage vs. Bandwidth usage

  • nginx
  • use Nginx if possible, its very fast and stable.

Mysql

  • USE MyISAM Engine wherever is possible – Its has good read speed

Query cache

  • Probably the most important thing to tune
  • Table cache
  • Also important Key buffer

PHP

  • Use a recent version
  • Install an Op­code cache / Accelerator
  • eAccelerator
  • APC
  • Xcache
  • Zend (commerical)

Op­code cache Benefits

  • Dramatic speed up of applications, specially complex ones like Drupal
  • Significant decrease in CPU utilization
  • Considerable decrease in memory utilization
  • The biggest impact on a busy site
  • Drawbacks:
  • May crash often
  • Use logwatcher to auto restart Apache

Note: eAccelerator uses the least memory and provides the most speed

Hope above point helps you in understanding what is important for your environment.

I'm happy to use Increase Sociability.