Speed up Magento by ~235%

How to REALLY speed up your Magento site:

The information below on enabling gzip compression will improve your speed a bit, but if you are using a bargain basement web host then that could be a major factor as well. XPC Web Hosting provides advanced technology for speeding up your sites with performance tuned servers in both the USA and Canada. Some of our latest improvements include nginx which speeds up image loading and our database backup system that creates two backups a day and stores off-site archives for 30 days in case of emergency. Learn more.

GZip Compression:
There’s a feature called “gzip” that’s installed by default on most web servers. Modifying your site to make use of it can really speed up the performance.

How much faster?
Try the quick and easy mod_gzip tester by WhatsMyIP.org. Just enter the URL and it will tell you how much faster it would be.

How to enable it for Magento
“One of the drawbacks of Magento is currently its speed if default configuration is used. There are certain ways of making it run faster. The best one is to enable GZip compression by changing .htaccess file a little. You just need to uncomment part of the code. In my case, the speed increase was exactly 235%.

Find the following lines in your Magento .htaccess file and replace them with the following code.

(You just have to uncomment the lines so it looks like the following)

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

# Insert filter
SetOutputFilter DEFLATE

# 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[/code]”
Source: inchoo.net

UPDATE: You need to uncomment the following as well:

[code]############################################
## enable resulting html compression

php_flag zlib.output_compression on[/code]

Thanks to Reno for pointing this out! It made a huge difference for me!

Leave a Reply

42 Comments

  1. Sam S

    Thanks for pointing that out – simple yet effective

  2. matt

    made little difference to us, thanks anyway.

  3. Dgiouzelis

    Hello there,
    this work for me, but i cant tell you the % of increase..
    but its faster!!!
    Thanks master

  4. This worked for me! 80.77% increase. I also had to uncomment this line:

    ############################################
    ## enable resulting html compression

    php_flag zlib.output_compression on

  5. Lasse

    Worked but not nearly 235% — but step by step. Trying to find other things to optimize as well.

    Thank you for this.

  6. Thanks. I am just testing my shop out at the moment, and it speed me up by about 86% or so on the data size for html….. thanks.

  7. luca

    nice, 71% faster.
    Was dead slow before but now works pretty nice

  8. Alice

    It doesn’t work at all… It’s still slow…

  9. Hey
    The gzip tester has been renamed and redesigned a little bit. It’s new address is: http://www.whatsmyip.org/http_compression/
    It’s also a bit more comprehensive. Some funny servers were saying they weren’t compressing data when they were. Now it doesn’t ask the server if it’s compressing, it manually checks itself every time.

  10. wow, has definitley speeded the site up thanks, but the compression checker still says its not gzipped.

    Thanks anyways

    Marty

  11. Alexander Baskhanov

    Im kinda new to magento, could anyone tell me where .htaccsess is located ?

  12. Alexander Baskhanov

    Will this work on litesped servers ?

  13. Simply amazing trick!!! That made a HUGE difference

  14. Gerbil

    Cheers.
    This should just be an automatic thing that is checked for and applied if available during installation – crackers!

  15. Chris Davies

    Absolutely incredible. WHAT A DIFFERENCE! Thanks for this, but why oh why isn’t this implemented as standard!??? Cheers again!

  16. I do follow this.
    After that my site is down?
    What’s happen?

    I use my old .htaccess But my site is donw.

    How can I do?

  17. Scott

    Has anyone had issues with the site displaying correctly in safari after this fix. We found it pretty unusable as safari would not load certain images and grid would jump the page. I found a link in the forums of someone talking about safari having a bug that did no allow proper gzip.

  18. Thankyou so much! my site actually version 1.3.2 is very fast after this simple modification!! It’s great!!
    For all its not solved, remember clean the magento cache after modification of .htaccess..

  19. Zeno

    Hey guys,
    this worked great for me, now i get 83.4% of data savings and dramatically improved my load time from 27.5 seconds to 2.75.

    Great!!!!!!
    Thanks!

  20. Mark

    I did this but i also noticed a difference, perhaps its new in 1.4.0.1 that i’m using… what should i do for this line…

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

    I uncommented it but i’m really not sure…

    also, i don’t notice any difference. What else do i have to do after changing the htaccess? do i have to manually zip the files myself?

  21. Kat

    It gained 80% of it’s speed!!!
    Thanks it finally feels like a “normal” page!!
    Sooooooooo relieved!

  22. This seems to be valid for old versions of magento . New version does have this functionality already. If i’m wrong then please correct me. Thanks

  23. Hi,
    I’ve just enabled the Gzip on the server (win 2003 standard with iis 6).
    Now, i have confirmed that the server as the Gzip activated with the test to a domain in the same server but when i try to test it on the Magento domain…it inst activated.
    Test Tool
    http://www.whatsmyip.org/http_compression/
    Domain in the same server
    http://directo.tr2k.com/login.aspx
    Domain with MAGENTO
    http://www.rockartstore.com/index.php/
    The .htaccess doest work on IIS so that’s not a solution…iv tried in the php.ini only seems to work on Apache.
    Any suggestions?
    Is there a place were i can enable it in the admin panel?

  24. John

    I’ve tried in on 1.4.0.1 and I keep getting a 500 error message, do you know what the problem might be?
    Thanks 🙂

  25. YOU stupid

    It’s useless
    It is network traffic.
    Not assoicated with performance.
    235 % ?
    YOU stupid………….

  26. YOU smart

    I agree.
    What a useless thing to do.
    Making things faster.. THATS NOT HOW THE INTERNET WORKS!!
    It’s ONE SPEED.
    Everything is 100% as fast as it can go, performance can’t be improved this way!

    *End Sarcasm*

  27. Hi, Thanks for this, seems to have improved speed on a clients website by about 100%.

  28. Fahad Rafiq

    In order to speed up the Magento Admin Panel, you need to:
    1. Set up Varnish cache
    2. Tune up the database
    3. Clean up the cache
    4. Delete unused extensions
    5. Delete out-of-sale products
    6. Reindex your products

    In order to speed up Magento Frontend performance, you need to:
    1. Compress the output
    2. Use Expires Headers
    3. Merge CSS files with JS files
    4. Use Memcached
    5. Use Parallel Downloads

    For more information, download the e-book, 11 Definite Ways To Speed Up Magento Websites, now.
    http://www.cloudways.com/en/speed-up-magento-website.php

Next ArticleGetting "As low as" on Magento unexpectedly?