Categories
Linux

Improve LAMP performance, for low cost servers or VPS

lamp_logo

As I said last day I’m just in a migration, I just did 2 sites a really not relevant one and deambulando.com, with lot of visitors. The server I’m using should be enough to handle the amount of visitors, but just in case I do a bit of tuning to improve the overall performance of the machine.

This config is meant for VPS servers like (or kind of):

  • Celeron 1.2Ghz
  • 512Mb Ram
  • 10Gb HD
  • 100Mbps upload/download
  • Linux

Depends in witch linux version you are running the LAMP the files can be in different paths, to find them you can always use : locate my.cnf

Apache (apache2.conf):

StartServers         2
MinSpareServers      5
MaxSpareServers     10
MaxClients         30
MaxRequestsPerChild  100

Php (php.ini):

max_execution_time 30
max_input_time 60
memory_limit 32M
output_buffering 4096

Mysql (my.cnf):

key_buffer_size = 256M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
set-variable=max_connections=200
set-variable=wait_timeout=15
max_connect_errors = 100

UPDATE: to help with the Mysql config I’ve found this awesome script

All this config parameters are the most relevant to improve anything. In my config all the parts where is memory I have double it, since I have 2Gb of memory, the rest remains almost the same.

Maybe you will not see a great speed improvement but if you have enough traffic you will see lot less stress in the server side.