- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们在自己的专用服务器上运行 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 驱动器组成,使用 SME 9 下的 Raid 软件进行镜像,剩余 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;
所有慢速查询都来自“高级搜索”。
该网站使用每个产品贡献的多个销售额。
有什么想法吗?我们错过了一些简单的事情吗?任何帮助、指导、想法或联系方式将不胜感激。
最佳答案
你看过 MySQL explain
命令的结果吗?我想数据库表中缺少一些索引。
参见docs了解模式详细信息。
关于php - 看似随机的挂断/延迟加载网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29379796/
我在 JavaScript 文件中运行 PHP,例如...... var = '';). 我需要使用 JavaScript 来扫描字符串中的 PHP 定界符(打开和关闭 PHP 的 )。 我已经知道使
我希望能够做这样的事情: php --determine-oldest-supported-php-version test.php 并得到这个输出: 7.2 也就是说,php 二进制检查 test.
我正在开发一个目前不使用任何框架的大型 php 站点。我的大问题是,随着时间的推移慢慢尝试将框架融入应用程序是否可取,例如在创建的新部件和更新的旧部件中? 比如所有的页面都是直接通过url服务的,有几
下面是我的源代码,我想在同一页面顶部的另一个 php 脚本中使用位于底部 php 脚本的变量 $r1。我需要一个简单的解决方案来解决这个问题。我想在代码中存在的更新查询中使用该变量。 $name)
我正在制作一个网站,根据不同的情况进行大量 PHP 重定向。就像这样...... header("Location: somesite.com/redirectedpage.php"); 为了安全起见
我有一个旧网站,我的 php 标签从 因为短标签已经显示出安全问题,并且在未来的版本中将不被支持。 关于php - 如何避免在 php 文件中写入
我有一个用 PHP 编写的配置文件,如下所示, 所以我想用PHP开发一个接口(interface),它可以编辑文件值,如$WEBPATH , $ACCOUNTPATH和 const值(value)观
我试图制作一个登录页面来学习基本的PHP,首先我希望我的独立PHP文件存储HTML文件的输入(带有表单),但是当我按下按钮时(触发POST到PHP脚本) )我一直收到令人不愉快的错误。 我已经搜索了S
我正在寻找一种让 PHP 以一种形式打印任意数组的方法,我可以将该数组作为赋值包含在我的(测试)代码中。 print_r 产生例如: Array ( [0] => qsr-part:1285 [1]
这个问题已经有答案了: 已关闭11 年前。 Possible Duplicate: What is the max key size for an array in PHP? 正如标题所说,我想知道
我正在寻找一种让 PHP 以一种形式打印任意数组的方法,我可以将该数组作为赋值包含在我的(测试)代码中。 print_r 产生例如: Array ( [0] => qsr-part:1285 [1]
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 9 年前。 Improve this ques
我在 MySQL 数据库中有一个表,其中存储餐厅在每个工作日和时段提供的菜单。 表结构如下: i_type i_name i_cost i_day i_start i_
我有两页。 test1.php 和 test2.php。 我想做的就是在 test1.php 上点击提交,并将 test2.php 显示在 div 中。这实际上工作正常,但我需要向 test2.php
我得到了这个代码。我想通过textarea更新mysql。我在textarea中回显我的MySQL,但我不知道如何更新它,我应该把所有东西都放进去吗,因为_GET模式没有给我任何东西,我也尝试_GET
首先,我是 php 的新手,所以我仍在努力学习。我在 Wordpress 上创建了一个表单,我想将值插入一个表(data_test 表,我已经管理了),然后从 data_test 表中获取所有列(id
我有以下函数可以清理用户或网址的输入: function SanitizeString($var) { $var=stripslashes($var); $va
我有一个 html 页面,它使用 php 文件查询数据库,然后让用户登录,否则拒绝访问。我遇到的问题是它只是重定向到 php 文件的 url,并且从不对发生的事情提供反馈。这是我第一次使用 html、
我有一个页面充满了指向 pdf 的链接,我想跟踪哪些链接被单击。我以为我可以做如下的事情,但遇到了问题: query($sql); if($result){
我正在使用 从外部文本文件加载 HTML/PHP 代码 $f = fopen($filename, "r"); while ($line = fgets($f, 4096)) { print $l
我是一名优秀的程序员,十分优秀!