Optimization for a VPS 4GB running multiple wordpress sites

#1
Hello

i have a 4GB VPS with LS/cpanel and 100WP Blogs.

Now I have problems since 2 weeks with the server load Up to 30.
where I can begin to reduce the server load.

in what configs I need to make settings ?


my.cnf
PHP:
[mysqld]
local-infile=0
datadir=/var/lib/mysql
query_cache_limit=3M
query_cache_size=256M ## 32MB for every 1GB of RAM
query_cache_type=1
max_user_connections=25
max_connections=50
interactive_timeout=30
wait_timeout=120
connect_timeout=20
thread_cache_size=128
key_buffer=128M ## 128MB for every 1GB of RAM
join_buffer=1M
max_connect_errors=20
max_allowed_packet=16M
tmp_table_size=256MB
max_heap_table_size=256MB
table_cache=4096
sort_buffer_size=1M ## 1MB for every 1GB of RAM
read_buffer_size=1M ## 1MB for every 1GB of RAM
read_rnd_buffer_size=4M  ## 1MB for every 1GB of RAM
thread_concurrency=2 ## Number of CPUs x 2
myisam_sort_buffer_size=64M
server-id=1
innodb_buffer_pool_size=2G

#slow_query_log = /var/log/mysql_slow_queries.log
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes
# this can be used on your own wish.
#collation-server=latin1_general_ci

[mysql.server]
user=mysql

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=10240

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=2M
write_buffer=2M

[myisamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=2M
write_buffer=2M

[mysqlhotcopy]
interactive-timeout
 

webizen

Well-Known Member
#3
Hello

i have a 4GB VPS with LS/cpanel and 100WP Blogs.

Now I have problems since 2 weeks with the server load Up to 30.
where I can begin to reduce the server load.

in what configs I need to make settings ?


...
run 'top' and see which process consumes the most resources/cpu cycles.
 
#5
PHP:
top - 04:05:51 up  4:21,  1 user,  load average: 6.29, 5.20, 3.56
Tasks: 143 total,   1 running, 142 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.3%us,  1.4%sy,  0.0%ni, 61.3%id, 29.3%wa,  1.6%hi,  0.1%si,  0.0%st
Mem:   4054456k total,  3517492k used,   536964k free,   105392k buffers
Swap:  6094840k total,      132k used,  6094708k free,  1748324k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                              
21101 iyangoo   15   0  168m  46m 8800 S 20.3  1.2   0:03.67 lsphp5                                                                               
21110 kiwiwin   17   0  161m  40m 7992 D 12.3  1.0   0:00.37 lsphp5:ntent/plugins/wptweetbomb/slaves/ad_slave.php                                 
21109 kiwiwin   15   0  162m  39m 8364 S 10.3  1.0   0:00.31 lsphp5:/home/kiwiwin/public_html/index.php                                           
 2784 mysql     15   0 2929m 1.1g 4964 S  4.0 29.7  28:27.29 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/l
 3146 nobody     0 -19 43676  24m  576 S  0.7  0.6   1:19.60 litespeed (lshttpd)                                                                  
20922 root      34  19  5688 2556  528 D  0.7  0.1   0:01.64 /usr/bin/updatedb -f sysfs?rootfs?bdev?proc?cpuset?binfmt_misc?debugfs?securityfs?soc
    1 root      15   0 10368  696  580 S  0.0  0.0   0:00.98 init [3]                                                                             
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.15 [migration/0]                                                                        
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 [ksoftirqd/0]                                                                        
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 [watchdog/0]                                                                         
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:00.17 [migration/1]
run 'top' and see which process consumes the most resources/cpu cycles.
 
Top