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

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

Hi

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:
#2
The web server is a VPS having 512MB RAM and 1Ghz CPU

here is my my.cnf file

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
old_passwords=1
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
skip-bdb
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout
 
#4
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
 

NiteWave

Administrator
#5
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 0.9.6.1 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:
#6
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 0.9.6.1 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.
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
checking for mysql_close in -lmysqlclient... yes
checking for MySQL UNIX socket location... no
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
mysql_config not found
configure: error: Please reinstall the mysql distribution
**ERROR** Could not configure PHP build
 
Last edited:

GaryT

Active Member
#8
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
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
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
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 :)
 
Top