前言:
     Magento 是一个开源电子商务系统,尤其以扩展性高著称,但是很高的扩展性往往是牺牲了速度为代价的,虽然现在magento为速度提升做了很多工作,但是还是没能达到人们对速度的要求。既然如此还是很自然的选择了它,它的速度让很多客户无法接受,最近忙碌于magento性能优化。
     经过优化后,速度上了几个台阶,觉得能让大部分人都接受了,据本人目测最少快了(7-8倍)。

参考结合了前辈的经验总结了如下很重要的几点:


1) Magento Caching. Magento 自身cache
Goto Magento Admin -> System -> Cache Management
- Tick the following items:
– Configuration
– Layouts
– Block HTML output
– Translations

2) MySQL Cache Size 设置
query_cache_size=128M
innodb_buffer_pool_size=64M
innodb_additional_mem_pool=16M

4) Enabling Gzipping 启用gzip压缩
.htaccess
php_flag zlib.output_compression on
AddHandler application/x-httpd-php5 .css

修改 .htaccess mod_deflate 配置
本人配置如下:

# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don't compress p_w_picpaths
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

5) Install Fooman Speedster 安装该插件

6) Install APC or Xcache 安装apc机器码缓存

<cache>
<backend>apc</backend>
<prefix>alphanumeric</prefix>
</cache>
添加到 app/etc/local.xml <global></global> 之间.

7) 设置apache 开启 KeepAlive

KeepAlive = On

LoadModule deflate_module     modules/mod_deflate.so #开启mod_deflate

参考地址:

http://www.magentocommerce.com/wiki/groups/168/optimising_your_web_stack_performance_for_magento

http://www.magentocommerce.com/boards/viewthread/36225/

出处: 马丁博客http://www.blags.org/

本文链接地址: http://www.blags.org/magento-performance-optimization/