Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2111977
  • 博文数量: 317
  • 博客积分: 5670
  • 博客等级: 大校
  • 技术积分: 3677
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-10 17:51
文章分类

全部博文(317)

文章存档

2016年(2)

2015年(44)

2014年(68)

2013年(42)

2012年(23)

2011年(51)

2010年(67)

2009年(17)

2008年(3)

分类: PHP

2014-03-25 17:45:48

前言:
      是一个开源电子商务系统,尤其以扩展性高著称,但是很高的扩展性往往是牺牲了速度为代价的,虽然现在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)  Cache Size 设置
query_cache_size=128M
innodb_buffer_pool_size=64M
innodb_additional_mem_pool=16M

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

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

 PHP
  1.     # Insert filter on all content  
  2.     SetOutputFilter DEFLATE  
  3.     # Insert filter on selected content types only  
  4.     #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript  
  5.   
  6.     # Netscape 4.x has some problems...  
  7.     BrowserMatch ^Mozilla/4 gzip-only-text/html  
  8.    
  9.     # Netscape 4.06-4.08 have some more problems  
  10.     BrowserMatch ^Mozilla/4/.0[678] no-gzip  
  11.    
  12.     # MSIE masquerades as Netscape, but it is fine  
  13.     BrowserMatch /bMSIE !no-gzip !gzip-only-text/html  
  14.    
  15.     # Don't compress images  
  16.     SetEnvIfNoCase Request_URI /.(?:gif|jpe?g|png)$ no-gzip dont-vary  
  17.    
  18.     # Make sure proxies don't deliver the wrong content  
  19.     "">Header append Vary User-Agent env=!dont-vary  

5) Install Fooman Speedster 安装该插件

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


apc
alphanumeric

添加到 app/etc/local.xml 之间.

7) 设置apache 开启 KeepAlive

KeepAlive = On (KeepAlive 配置指令决定当处理完用户发起的 HTTP 请求后是否立即关闭 TCP 连接,如果 KeepAlive 设置为On,那么用户完成一次访问后,不会立即断开连接,如果还有请求,那么会继续在这一次 TCP 连接中完成,而不用重复建立新的 TCP 连接和关闭TCP 连接,可以提高用户访问速度。);

LoadModule deflate_module     modules/mod_deflate.so #开启mod_deflate

参考地址:

出处: []

本文链接地址: 

阅读(1270) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~