Magento 是一款著名的电子商务系统,功能齐全并且易于拓展、优秀的SEO,是众多电商选择Magento的理由。
Magento 拥有众多优点, 但是 Magento 也有很多不足。Magento 强大的 XML 配置系统和多模块耦合导致它运行起来非常缓慢,EAV 模型的应用导致数据库压力过大,虽然可以通过开启 Catalog Flat 表来减小 EAV 带来的数据库性能问题,但又引入了 Catalog Flat 表中数据不能及时更新的隐患,Catalog Flat 表中数据的更新依赖于对索引表的刷新,如果产品数量很大,刷新索引就需要很长时间,同时在刷新索引的过程中对数据库的压力非常大。
Magento 为了应对性能上的不足,主要有以下2种措施:
1. 开启 Catalog Flat 表来减小对数据库的压力
2. 利用各级缓存系统来提高性能,具体的缓存种类有
(1) System(config.xml, local.xml) and modules configuration files(config.xml).
(2) Layout building instructions.
(3) Page blocks HTML.
(4) Translation files.
(5) Collection data files.
(6) Entity types declaration cache.
(7) Web Services definition files.
(8) Full Page Cache (Enterprise Edition)
对 Magento 做性能优化,我主要的想法是:
(1) 给 Magento 的缓存增加 Redis 层
(2) 安装 MongoDB,将 Catalog Flat 表移到 MongoDB 中
以下是该系列文章链接,文章将不定期更新:
(1) 利用 XHProf 查找 Magento 具体慢在哪