我们在自己的专用服务器上运行OS Commerce支持的网页。去年4月,我们被迫升级服务器。在这一点上,我们开始注意到,似乎随机的网站中断,我们的页面无法从任何计算机上查看,当时唯一的解决方案是在我们的服务器上进行硬重启。这发生了大约一个月。这个问题已经解决了,但现在我们面临着不同的挑战。我们的网站似乎随机放慢了速度。有时页面加载速度非常快,有时加载最多需要2分钟。我们可以弄清楚似乎没有这种模式。该网站是www.westerndepot.com。我们尝试使用Yslow和类似的方式查看我们的网站运行状况,但我们运行的所有查询都显示我们的网站评价为“A”。它似乎是等待时间波动而不是实际加载时间。最近的Firebug诊断显示23.9秒的等待时间和24.17秒的加载时间。
服务器有64GB的RAM,当前使用的最大RAM显示为10GB。我们正在使用SME Server 9.0。该服务器由两个WD Caviar Black 1TB驱动器组成,使用软件Raid在SME 9下镜像,剩余833 GB可用空间。 products_to_categories表有13923个产品的18375个条目,其中2427个产品处于非活动状态。共有385个类别。
我们的MySQL配置文件如下:
character-set-server=utf8
collation-server=utf8_general_ci
key_buffer_size=2048M
preload_buffer_size=512M
query_cache_limit=64M
query_cache_size=512M
query_cache_type=1
query_prealloc_size=512M
read_buffer_size=2M
read_rd_buffer_size=4M
sort_buffer_size=2M
thread_cache_size=300
join_buffer_size=256K
table_open_cache=512K
tmp_table_size=256M
max_heap_table_size=256M
slow_query_log=1
max_connections=500
concurrent_insert=2
log_output=FILE
以下是慢查询日志的示例。
# Query_time: 12.277704 Lock_time: 0.000193 Rows_sent: 1 Rows_examined: 39652497
SET timestamp=1427835801;
select count(distinct p.products_id) as total from products p left join manufacturers
m using(manufacturers_id) left join (select * from (select products_id, specials_new_products_price
, expires_date, status from specials where status = 1 order by products_id, specials_new_products_price,
expires_date) as t group by products_id) as s on p.products_id = s.products_id left join
products_to_notes ptn on ptn.products_id = p.products_id join products_description
pd on p.products_id = pd.products_id join (select products_id from
products_to_categories where (categories_id not in (728)) group by products_id) as
p2c on p.products_id = p2c.products_id where p.products_status = '1';
# Query_time: 11.654512 Lock_time: 0.000367 Rows_sent: 240 Rows_examined: 36425129
SET timestamp=1427835812;
select distinct m.manufacturers_name, p.products_model, p.products_image,
p.image_folder, p.image_display, p.products_quantity, p.hide_qty_over,
p.products_bundle, IF(s.status, s.expires_date, NULL) as expires_date,
m.manufacturers_id, p.products_id, pd.products_name, p.products_msrp,
p.products_price, p.products_tax_class_id, IF(s.status,
s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price) as final_price,
p.sold_in_bundle_only, p.products_type , pd.extra_value_id6 , pd.extra_value_id10
from products p left join manufacturers m using(manufacturers_id) left join
(select * from (select products_id, specials_new_products_price, expires_date,
status from specials where status = 1 order by products_id,
specials_new_products_price, expires_date) as t group by products_id) as s on
p.products_id = s.products_id left join products_to_notes ptn on ptn.products_id =
p.products_id join products_description pd on p.products_id = pd.products_id join
(select products_id from products_to_categories where (categories_id not in (728))
group by products_id) as p2c on p.products_id = p2c.products_id where
p.products_status = '1' order by products_name limit 2160, 240;
所有慢速查询都来自“高级搜索” 该网站每个产品贡献使用多个销售。
有什么想法?我们错过了简单的事吗?任何帮助,方向,想法或联系人将不胜感激。