Magento 加载时间的瓶颈在哪里
我正在尝试提高 Magento 商店 http://www.jinkou.info 的加载时间pingdom工具的首页是13秒!看来 pingdom 读出的延迟是“连接”后的绿色部分,
什么可能导致这个瓶颈?
I am trying to improve the load speed of my Magento store http://www.jinkou.info the load time for the front page on pingdom tools is 13 seconds! It seems that the delay in the pingdom readout is the green section after "connect"
What is likely to be causing this bottleneck?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
首先,您需要确保 Magento 缓存已启用。您可以在管理-> 中进行操作系统->缓存管理。应在那里启用所有缓存数据。
如果没有帮助,您需要启用 Profiler,这将帮助您以页脚中的表格形式查看瓶颈。您可以通过 2 个步骤完成:
编辑 Magento 的 index.php 文件,并取消注释此行:
Varien_Profiler::enable();
完成步骤 1 和 2 后,转到任意页面,查看页脚。
First of all, you need to make sure that Magento cache is enabled. You can do it in Admin -> System -> Cache Management. All cache data should be enabled there.
If it didn't help, you need to enable Profiler, and this will help you to see bottlenecks as a table in the footer. You can do it in 2 steps:
Edit Magento's index.php file, and uncomment this line:
Varien_Profiler::enable();
After steps 1 and 2 has been done -- go to any page, a look at the footer.
Magento 当然确实喜欢大量使用数据库,每次查询都意味着到光盘的往返,而没有执行任何其他操作。确保 MySQL 已打开查询缓存并为其分配大量内存,对于大型站点,需要数 GB。这就是为什么专用服务器是最好的。
从测试中我发现最大的 CPU 消耗是运行 PHP。即使使用操作码缓存,它仍然是一种解释性语言,而且成本很高。将 PHP 作为单独的 FastCGI 进程运行。如果遵循传统的三层方法,这也将是一个专用服务器。
仅当您有多个 PHP 服务器时才使用 Memcache,否则只需将 var/cache/ 挂载为 tmpfs。
最后,正如 rpSetzer 所说 - 毫无疑问其他人也会说 - 使用块缓存。
更多块缓存。
页面缓存。
Magento certainly does like to use the database a lot and every query means a roundtrip to the disc while nothing else is being done. Make sure MySQL has query cache turned on and has lots of memory assigned to it, for large sites several gigabytes are needed. This is why a dedicated server is best.
From tests I find that the biggest CPU cost is running PHP. Even when using an opcode cache it is still an interpreted language and that is expensive. Run PHP as a separate FastCGI process. If following the traditional three-tier approach this would also be a dedicated server.
Only use Memcache if you have more than one PHP server, otherwise just mount
var/cache/
as tmpfs.Lastly as rpSetzer has said - and no doubt others will say - use block caching.
More block caching.
Page caching.
很难说,这里有一些肯定有帮助的提示:
Hard to say, here are a few tips that can certainly help:
加载站点时必须启用 Magento 缓存。但真正起作用的是 PHP 缓存。我们使用 APC,这是一个主要区别。
还要确保调整您的数据库! MySQL 调优带来了巨大的改进。 Google MySQL 调整 你会发现。
Magento caching must be enabled when the site gets loaded. But what really makes a difference is a PHP cache. We use APC and its a major difference.
Also make sure to tune your database! MySQL tuning makes a uge improvement. Google for MySQL tuning and you will find.
借助 magento 速度分析器模块,您可以找到每个块的加载时间。
借助速度分析器模块,您可以找到每个块的加载时间。
http://www.magentocommerce.com/magento-connect/speed-analyzer.html
with the help of magento speed analyzer module you can able to find each block load time.
with the help of speed analyzer module you can able to find each block load time.
http://www.magentocommerce.com/magento-connect/speed-analyzer.html