magento性能優化.magento速度優化

magento是最近很是火爆的開源外貿電商系統,如今國內愈來愈多的公司已經開始使用magento.隨着使用人數的增長,magento問題也愈來愈突出。我發現你們最關注的莫過於「速度」,俗話說天下武功,惟快不破。當一個網站速度像蝸牛同樣慢,誰都沒法忍受,magento因爲自己架構問題,速度成爲了一個大瓶頸.下面我介紹幾個效果比較好,並且簡單易用的方法。 node

magento結合APC,Memcached,Redis緩存機制配置教程

理解magento的Two-Level Caching
magento默認使用zend framework的二層緩存存儲方式。就是說它使用兩層結構對cache進行配合管理,一個快的,但大小有限制的結構是一層好比APC或者Memcached ,一個比較慢的結構做爲第二層好比file system.每一種存儲結構各有利弊,要不一樣狀況不一樣分析使用,APC 和 Memcached 是使用 key/value來存儲cache,他們都不支持tag。File system 和Redis 支持tag.
magento二級緩存結構工做流程圖示 (Thanks to Fabrizio Branca):


git

如下爲magento APC,Memcached,Redis緩存機制配置教程 github

1.文件緩存File system (var/cache)(默認) 緩存

優勢:不需安裝其餘控件,不須要額外配置 服務器

缺點:IO讀取,訪問量大時下降服務器性能 架構

2.APC – Alternative PHP Cache (Key/Value) app

配置方法: socket

<global> ... <cache> <backend>apc</backend> <prefix>mgt_</prefix> </cache> ... </global>

3.Memcached memcached

配置方法: 性能

<global> ... <cache> <backend>memcached</backend><!-- apc / memcached / empty=file --> <memcached><!-- memcached cache backend related config --> <servers><!-- any number of server nodes can be included --> <server> <host><![CDATA[127.0.0.1]]></host> <port><![CDATA[11211]]></port> <persistent><![CDATA[1]]></persistent> </server> </servers> <compression><![CDATA[0]]></compression> <cache_dir><![CDATA[]]></cache_dir> <hashed_directory_level><![CDATA[]]></hashed_directory_level> <hashed_directory_umask><![CDATA[]]></hashed_directory_umask> <file_name_prefix><![CDATA[]]></file_name_prefix> </memcached> </cache> ... </global>

4.Redis
安裝Magento Redis Cache插件 https://github.com/colinmollenhour/Cm_Cache_Backend_Redis

 配置方法:

<global> 
<cache> 
<backend>Cm_Cache_Backend_Redis</backend> <backend_options>
 <server>127.0.0.1</server> 
<!-- or absolute path to unix socket --> 
<port>6379</port> 
<persistent></persistent> 
<database>0</database> 
<password></password>
 <force_standalone>0</force_standalone> 
<connect_retries>1</connect_retries>
 <automatic_cleaning_factor>0</automatic_cleaning_factor> 
<compress_data>1</compress_data> 
<compress_tags>1</compress_tags> 
<compress_threshold>20480</compress_threshold> 
<compression_lib>gzip</compression_lib> 
<!-- Supports gzip, lzf and snappy --> 
</backend_options> 
</cache> 
</global>

若是想瀏覽更多關於magento的資料請瀏覽個人 magento博客
相關文章
相關標籤/搜索