Litspeed+mysql+php slow loading websites + CPU spikes problem

Discussion in 'General' started by adithya, Jul 16, 2010.

  1. adithya

    adithya Member

    Litespeed+mysql+php slow loading websites + CPU spikes problem


    First of all cheers for Litespeed developers for developing a easy to use,lite apache alternative :)

    This is my first post here.

    I have installed Litespeed+mysql+php + proftpd

    I have optimized all to use low memory. The memory usage is 98 Mb and during peak/busy times its not exceeding 250 MB max
    So nearly half of RAM is free at any time

    But i have 2 new problems now.. May be my over optimization caused these

    1. Slow loading time .. Earlier my site used to load 24 queries. 0.2 seconds for wordpress sites.
    Now the same wordpress sites are taking 0.5-0.6 sec to load 24 queries

    2.CPU spikes : the lshttpd and lsphp5 process spikes CPU to as high as 80-90% but within seconds it comes down to 0%
    the cpu load overall has never crossed 2
    I have searched for this problem and found out that CPU spikes are normal for Litespeed..
    Last edited: Jul 16, 2010
  2. adithya

    adithya Member

    The web server is a VPS having 512MB RAM and 1Ghz CPU

    here is my my.cnf file

  3. adithya

    adithya Member

    Here are the screen shots of litespeed config

    Attached Files:

  4. adithya

    adithya Member

    Any help so that i can optimize the vps for high traffic wordpress sites ..even if it uses a extra memory,since i have almost 50%+ remaining RAM
  5. NiteWave

    NiteWave Administrator

    a few suggestions:
    1. if possible, build php 5.3.2 instead of 5.2.x. 5.3.2 using --with-mysql=mysqlnt --with-mysqli=mysqlnt

    2.install eAccelerator if not yet -- this will reduce CPU load

    3.install wordpress super-cache

    if you mainly run wp, no other account on your VPS, then can install other opcode cache -- like APC, XCache as well. in either case be sure to disable php suExec so you can use shared memory to store opcode cache.
    Last edited: Jul 16, 2010
  6. adithya

    adithya Member

    Thanks for the reply
    Already using wordpress super-cache and have installed eAccelerator but was not able to locate php.ini so eAccelerator is not working .. :(

    I have already built 5.3.2 using --with-mysql option .. when i tried to build it using --with-mysql=mysqlnt --with-mysqli=mysqlnt , i am getting error :(
    OS is centos 5.5
    Last edited: Jul 16, 2010
  7. NiteWave

    NiteWave Administrator

    sorry, typo. should be --with-mysql=mysqlnd --with-mysqli=mysqlnd
  8. GaryT

    GaryT Active Member

    I had this issue where I could not build - You may have to switch back to apache first - Do the rebuild then switch to litespeed and rebuild that.

    This worked for me, Building apache when litespeed is enabled will cause such errors.
  9. adithya

    adithya Member

    Things going on good so far ...
    I have installed eaccelerator and it has given a siginificant improvement.. Now my sites are loading faster

    And mem usage has been close to 256 MB MAX during peak time
    CPU spikes are reduced ... load average: 0.91, 0.59, 0.46

    BTW one suggesion to litespeed developers .. Automate the task of enabling eaccelerator during setup itself ..Many new users will not be able to do that easily..

    I found out that php.ini is not automatically generated and i have to copy the php-production.ini file to lib folder and then have to modify the php.ini to enable this extension .. :)
  10. adithya

    adithya Member

    Now one task remains ..
    VPS hardening .. I have created individual users for each sites protected by password .. Root password is strong enough.. There are just php,mysql,ftp,litespeed in the server .. Have protected many important locations with .htaccess file .. So is there any need for VPS hardening/secure ..? Or litespeed automatically takes care of security :)

Share This Page