Speed up Magento by ~235%

September 10, 200838 Comments

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)

############################################
## 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


Source: inchoo.net

UPDATE: You need to uncomment the following as well:

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

php_flag zlib.output_compression on

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

38 Responses to “Speed up Magento by ~235%”

  1. Sam S says:

    Thanks for pointing that out – simple yet effective

  2. Hey man. Thanks for putting the referrer source. I’m glad it helped you. :)

  3. matt says:

    made little difference to us, thanks anyway.

  4. Dgiouzelis says:

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

  5. Reno says:

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

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

    php_flag zlib.output_compression on

  6. Lasse says:

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

    Thank you for this.

  7. Silverback says:

    Thanks! I hope this helps!

  8. adam says:

    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.

  9. neo says:

    Hi, I did as what you told, but when I test with http://www.whatsmyip.org/mod_gzip_test/ it still says that my site is not gzipped. what’s problem, I think I did everything right.
    thanks.

  10. luca says:

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

  11. Alice says:

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

  12. John says:

    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.

  13. Neovirtua says:

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

    Thanks anyways

    Marty

  14. Alexander Baskhanov says:

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

  15. Alexander Baskhanov says:

    Will this work on litesped servers ?

  16. Matt says:

    Simply amazing trick!!! That made a HUGE difference

  17. Gerbil says:

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

  18. Chris Davies says:

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

  19. Pon says:

    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?

  20. Pon says:

    It’s ok my hosting have some problem about cache.
    Sorry.

    My web is very fast!

    You can try. (My hosting is in Thailand)

    http://www.clothes.in.th

  21. Scott says:

    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.

  22. Suricate says:

    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..

  23. Zeno says:

    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!

  24. fred perry says:

    really helping man 200% easy thanks!!!!

  25. Coffee Pods says:

    still not working for me

  26. Thanks for the solution. worked great

  27. Mark says:

    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?

  28. Kat says:

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

  29. Pulkit says:

    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

  30. Duarte says:

    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?

  31. John says:

    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 :)

  32. w00t! Thanks this helped a little

  33. Lukas says:

    Very usefull is also MTurbo accelerator for Magento http://www.artio.net/magento-extensions/m-turbo-accelerator

  34. Ehsan says:

    Thanks, It worked

  35. YOU stupid says:

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

  36. YOU smart says:

    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*

  37. 500 error says:

    I get internet 500 error
    what to do?

  38. saxo says:

    Great! Thank you.

Leave a Reply