How to optimize Magento performance

Overview
This guide demonstrates how to optimize Magento performance. Most optimizations will work with any version of Magento. Those intended for specific versions will be indicated as such.

Tweak .htaccess

The default .htaccess file that comes with Magento has several sections dealing with performance. The following configurations are commented out and must be enabled to realize their benefit.

Enable output compression

This section will turn on the apache mod_deflate module, which compresses text, css, and javascript before it is sent to the browser. This achieves a smaller download size. To enable, simply uncomment the appropriate lines so that it looks like the following:

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # 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 application/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 images
    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

Enable expires headers

Attention: This will not work on LiteSpeed servers.

Browsers use Expires headers to determine how long a page component can be cached. Static components, like images, should have far-future expires headers, but all page components should have expires headers. To activate this feature, uncomment the appropriate line and add ExpiresActive On directly above it:

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresActive On
    ExpiresDefault "access plus 1 year"

Disable ETags

ETags are a way for browsers to validate cached components across subsequent visits. They can slow down a site served from a cluster if the cluster has not implemented them properly. It is best to disable them as follows:

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    FileETag none

Magento administrative tweaks

Generally, these features are available on versions 1.4.0.1 and higher and should be performed after completing the majority of developmental tasks.

Combine CSS and JS files

This feature reduces the number of HTTP requests. For versions earlier than 1.4.x, use the Fooman_Speedster extension instead.

Attention: Combining CSS/JS when using CDN will cause CSS/JS to "break" until the CDN updates completely. Nexcess recommends starting this process at the beginning non-peak hours to allow enough time for the "new" CSS/JS to reach the CDN.

  1. In the Magento Admin, select System > Configuration > Developer.
  2. Under Javascript Settings, change Merge Javascript Files to YES.
  3. Under CSS Settings, change Merge CSS Files to YES.
  4. Clear the cache.

Enable flat catalog

Magento uses the EAV model to store customer and product data. This enables these objects to be incredibly extensible, but results in longer SQL queries and more reads. Enabling the Flat Catalog for Categories and Products merges product data into one table, thereby improving performance. Generally, all stores should enable Flat Catalog for Categories. Stores with over 1000 products should enable Flat Catalog for Products.

  1. From the Magento administator interface , go to System > Configuration > Catalog.
  2. Under Frontend, change "Use Flat Catalog Category" to YES.
  3. If desired, under Frontend, change "Use Flat Catalog Product" to YES.
  4. Clear the cache.

Other performance tweaks

Configure the Nexcess CDN

For details, refer to How to configure the Nexcess CDN with Magento.

Clean the database

Magento‘s database can quickly become sluggish due to unmaintained log tabes. Refer to Magento Database Maintenance for information regarding database maintenance.

Posted - Mon, Jul 29, 2013 at 11:55 PM 
Filed Under: Magento

- See more at: http://docs.nexcess.net/article/optimizing-magento-performance.html#sthash.gGcybDSA.dpuf

http://www.magespeedtest.com/

时间: 2024-10-21 17:44:08

How to optimize Magento performance的相关文章

Permanent Link: 101 ways to speed up your Magento e-commerce website

101 ways to speed up your Magento e-commerce website May 18, 2010/in E-commerce, Magento /by Guido Jansen As you probably know by now, Google is Using site speed in web search ranking. And I couldn’t agree more: speed is important for your site, and

Goal driven performance optimization

When your goal is to optimize application performance it is very important to understand what goal do you really have. If you do not have a good understanding of the goal your performance optimization effort may well still bring its results but you m

Android应用程序性能优化Tips

主要介绍一些小细节的优化技巧,虽然这些小技巧不能较大幅度的提升应用性能,但是恰当的运用这些小技巧并发生累积效应的时候,对于整个App的性能提升还是有不小作用的.通常来说,选择合适的算法与数据结构会是你首要考虑的因素,在这篇文章中不会涉及这方面的知识点.你应该使用这篇文章中的小技巧作为平时写代码的习惯,这样能够提升代码的效率. 通常来说,高效的代码需要满足下面两个原则: 不要做冗余的工作 尽量避免执行过多的内存分配操作 To ensure your app performs well across

[转] Fix: Screen Clipping Shortcut In OneNote Not Working After Upgrading To Windows 8.1

RECOMMENDED: Click here to fix Windows errors and optimize system performance No doubt, OneNote is yet another useful component of Microsoft‘ productivity suite aka Office. Using OneNote, you can easily clip your immediate notes. For this to be worke

C# Heap(ing) Vs Stack(ing) in .NET [C# 堆和栈的使用以及垃圾回收原理]

最近在<C#Corner>上看到了一篇关于.NET内存管理以及垃圾回收的文章,虽说是英文的内容,但还是硬着头皮读了下来.发现并不是我原本想象中的那么枯燥,因为语言通俗而且还有很多图片示意,感觉让我又对"堆"和"栈"以及垃圾回收机制有了更加深刻的理解和认知,记录下来提醒自己尽量书写优质的代码,而不是只管实现功能,不管性能优劣去蛮干.  [文章出自: http://www.c-sharpcorner.com/article/c-sharp-heaping-v

Building Maintainable Software-java篇之Write Short Units of Code

Building Maintainable Software-java篇之Write Short Units of Code Any fool can write code that a computer can understand. Good programmers write code that humans can understand. -Martin Fowler Guideline: ? Limit the length of code units to 15 lines of c

深入内存

今天在网上看到了这样一个问题,"如果malloc 了一块字符串的内存,然后,它改变了这个字符串的大小,问会不会有一部分内存没有被释放掉."这个问题,以前的确没有仔细想过. 当然,我觉得是肯定会释放掉的,但是一直没有了解过free 的原理,不敢乱说.我看了一下操作系统的内存管理,基本上是这样的,当然各个系统的实现不一样. 操作系统管理内存,维护了一个空闲内存链表,malloc从个链表中选出一个来使用,每个内存块都有一个头部来表示这个内存的基本信息,如内存大小,所以free 时候 能够记住

&lt;modules runAllManagedModulesForAllRequests=&quot;true&quot; /&gt;(转1)

最近在使用 MVC 开发的时候,遇到一个对我来说“奇怪的问题”,就是使用 BundleTable 进行 CSS.JS 文件绑定,然后使用 Styles.Render.Scripts.Render 进行获取,但总是获取不到绑定的 CSS.JS 文件,然后报“404错误”,话说再多,不如一个代码示例. BundleConfig 配置代码: public class BundleConfig { // For more information on bundling, visit http://go.

asynchronous-logging-with-log4j-2--转

原文地址:https://dzone.com/articles/asynchronous-logging-with-log4j-2 Log4J 2 is a logging framework designed to address the logging requirements of enterprise applications. If you are new to Log4J2, I suggest going through my introductory post on Log4J