Magento 通常这么慢吗?
Is Magento usually so terribly slow?
这是我第一次使用它,管理面板需要很长时间才能加载和保存更改.它是带有测试数据的默认安装.
This is my first experience with it and the admin panel simply takes ages to load and save changes. It is a default installation with the test data.
托管它的服务器以超快的速度为其他非 Magento 站点提供服务.Magento 使用的 PHP 代码是什么导致它变得如此缓慢,以及可以做些什么来修复它?
The server where it is hosted serves other non-Magento sites super fast. What is it about the PHP code that Magento uses that makes it so slow, and what can be done to fix it?
我只是偶尔参与了 Magento 的性能优化,但这里有一些系统如此缓慢的原因
I've only been tangentially involved in optimizing Magento for performance, but here's a few reasons why the system is so slow
部分 Magento 使用在 MySQL 之上实现的 EAV 数据库系统.这意味着查询单个事物"通常意味着查询多行
Parts of Magento use an EAV database system implemented on top of MySQL. This means querying for a single "thing" often means querying multiple rows
幕后有很多事情(应用程序配置、系统配置、布局配置等)涉及在内存中构建巨大的 XML 树,然后查询"这些相同的树以获取信息.这需要内存(存储树)和 CPU(解析树).其中一些(尤其是布局树)是巨大的.此外,除非打开缓存,否则这些树是从磁盘上的文件和每个请求构建的.
There's a lot of things behind the scenes (application configuration, system config, layout config, etc.) that involve building up giant XML trees in memory and then "querying" those same trees for information. This takes both memory (storing the trees) and CPU (parsing the trees). Some of these (especially the layout tree) are huge. Also, unless caching is on, these tree are built up from files on disk and on each request.
Magento 使用其配置系统来允许您覆盖类.这是一个强大的功能,但它意味着无论何时实例化模型、助手或控制器,都需要运行额外的 PHP 指令来确定是否需要原始类文件或覆盖类文件.这加起来.
Magento uses its configuration system to allow you to override classes. This is a powerful feature, but it means anytime a model, helper, or controller is instantiated, extra PHP instructions need to run to determine if an original class file or an override class files is needed. This adds up.
Magento 的模板系统除了布局系统,还涉及到大量的递归渲染.这加起来.
Besides the layout system, Magento's template system involves a lot of recursive rendering. This adds up.
总的来说,Magento 工程师的首要任务是构建尽可能灵活、可定制的系统,然后再担心性能问题.
In general, the Magento Engineers were tasked, first and foremost, with building the most flexible, customizable system possible, and worry about performance later.
为确保更好的性能,您可以做的第一件事是打开缓存(系统 -> 缓存管理).这将缓解 Magento 构建其各种 XML 树时发生的一些 CPU/磁盘阻塞.
The first thing you can do to ensure better performance is turn caching on (System -> Cache Management). This will relieve some of the CPU/disk blocking that goes on while Magento is building up its various XML trees.
您要做的第二件事是确保您的主机和运营团队具有 Magento 性能调优经验.如果您依靠每月 7 美元的计划来帮助您度过难关,那么祝您好运.
The second thing you'll want to do is ensure your host and operations team has experience performance tuning Magento. If you're relying on the $7/month plan to see you through, well, good luck with that.
这篇关于为什么 Magento 这么慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!