512MB VPS性能优化

free -m 看到可用内存只有4MB了,必须对apache和mysql做优化了,之前都是默认配置在裸奔.

apache

修改apache2.conf ,重点是prefork module ,因为prefork是apache默认的工作模式


    StartServers          1
    MinSpareServers       3
    MaxSpareServers      6
    MaxClients           24
    MaxRequestsPerChild  250

mysql
key_buffer              = 16M
max_allowed_packet      = 8M
thread_stack            = 192K
thread_cache_size       = 8

...

跑几天试试看,根据具体情况继续优化