【发布时间】:2015-04-14 11:59:00
【问题描述】:
最近一位客户在 1&1 购买了 VPS,我将 Worpress 网站从旧的共享主机 (Bluehost) 移到了新的 VPS。该站点非常慢,我不知道如何解决这个问题,这意味着在哪里攻击,如果我应该在 Apache 中优化某些东西,是否应该安装一些插件来避免这种情况或其他什么,所以我需要一些忠告。围绕该 WP 的一些数据:
- 数据库拥有大约 35k 个帖子
- 我已禁用 W3C Total Cache 插件,因为我认为未配置好并且会降低网站速度
- 我没有使用任何像
thimbthumb这样的图像压缩器(这是首先安装的,但出于安全原因,我从网站上删除了) - VPS 有两个内核和 4GB 内存,运行 Centos、PHP 5.3.3、MySQL 5.5.x 和 Apache 2.2.15
谁能给我一些想法?建议?经验?不知道还能做什么或如何解决这个问题,我的知识还没有到此为止。
注意:该站点是this自己测试并注意它有多慢
执行测试:
为了找到我启用的瓶颈:
-
Wordpress 调试日志:
define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); @ini_set('display_errors',0);这会记录大多数时间的错误,例如
[13-Feb-2015 12:01:46] PHP Notice: Undefined property: stdClass::$category_parent in /var/www/vhosts/elclarinweb.com/httpdocs/sistema/wp-content/themes/elclarin_v2/functions.php on line 136 MySQL 日志:
mysql.log、mysqld.log和mysqld_slow.log
对于mysql.log,我注意到大量访问,对于mysqld_slow.log,我注意到以下输出:
SET timestamp=1423830131;
SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
# User@Host: elclarin_us[elclarin_us] @ localhost []
# Query_time: 0.001520 Lock_time: 0.000043 Rows_sent: 227 Rows_examined: 261
SET timestamp=1423830131;
SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
# Time: 150213 13:22:14
# User@Host: elclarin_us[elclarin_us] @ localhost []
# Query_time: 0.003051 Lock_time: 0.000097 Rows_sent: 227 Rows_examined: 261
SET timestamp=1423830134;
SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
# User@Host: elclarin_us[elclarin_us] @ localhost []
# Query_time: 0.003259 Lock_time: 0.000097 Rows_sent: 227 Rows_examined: 261
SET timestamp=1423830134;
SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
# Time: 150213 13:22:15
# User@Host: elclarin_us[elclarin_us] @ localhost []
# Query_time: 0.001597 Lock_time: 0.000048 Rows_sent: 227 Rows_examined: 261
为什么总是执行相同的查询?任何网络服务器线程正在杀死我的 Wordpress?
【问题讨论】:
标签: mysql wordpress performance apache caching