请帮我减less高负荷的WordPress网站

我有一个专用的服务器。 自从我从2.8.4升级Wordpress到最新版本以来,我看到了非常高的CPU使用率。 另外我更新了插件。 我使用wp超级caching。 压缩启用,caching在10天内过期。 超过45,000个职位。

内存使用率只有20%,我可以进行更改,使内存使用量可能增加到40%,但CPU负载应该下降?

服务器信息

8核心,全部:

Vendor GenuineIntel Name Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz Speed 2933.533 MHz Cache 8192 KB 

内存信息

 Memory: (16 GB) 16391660k/17825792k available (2606k kernel code, 343628k reserved, 1665k data, 224k init) 

系统信息

 Linux 2.6.18-274.17.1.el5 #1 SMP Tue Jan 10 17:25:58 EST 2012 x86_64 x86_64 x86_64 GNU/Linux 

 Server load 15.88 (8 CPUs) Memory Used 19.69% (3,227,356 of 16,394,544) Swap Used 0.01% (208 of 2,096,472) 

 Server Version: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 Server Built: May 2 2012 09:35:50 Current Time: Wednesday, 02-May-2012 19:23:09 IST Restart Time: Wednesday, 02-May-2012 09:48:43 IST Parent Server Generation: 6 Server uptime: 9 hours 34 minutes 26 seconds Total accesses: 5691409 - Total Traffic: 99.8 GB CPU Usage: u103.95 s37.95 cu2261.29 cs0 - 6.97% CPU load 165 requests/sec - 3.0 MB/second - 18.4 kB/request 700 requests currently being processed, 0 idle workers 

httpd.conf文件

 keepalive is off <module prefork.c> StartServers 5 MinSpareServers 5 MaxSpareServers 15 ServerLimit 700 MaxClients 700 MaxRequestsPerChild 0 </IfModule> max_connections=256 log-slow-queries = /tmp/slow.log long_query_time = 1 thread_cache_size = 2512M tmp_table_size = 4024M max_heap_table_size = 4024M query_cache_size = 24M query_cache_limit = 72M table_cache = 2048 table_open_cache = 1024 table_definition_cache = 1284M key_buffer=1024M read_buffer_size=24M read_rnd_buffer_size=32M sort_buffer_size=8M thread_concurrency = 8 

试着找出哪个进程占用了大部分的CPU时间 – 你可以从头开始。 是apache2 [内容的php +服务]还是它的MySQL? 没有这些基本的信息,这只是一个猜测。

或者你可能只是高负载,但CPU大多是空闲的[进程之间的忙切换或疯狂地交换/等待磁盘io]?

安装munin [或cacti],并开始收集服务器负载的统计信息…这是非常有用的,特别是如果你有历史数据,并可以很容易地看到什么改变了以前的基准。

如果你的高服务器负载是由大量的apache进程引起的 – 也许是时候转移到更有效率的服务器[比如nginx ]来服务你的静态内容[也可能是dynamic的]。

你的mysqlconfiguration看起来很奇怪 – 你似乎有非常高的tmp_table_size,thread_cache_size和其他值很高的值。 你可以试试:

  • 将所有表格转换为innodb
  • 使用由percona的mysqlconfiguration向导或mysqltuner.pl生成的configuration