Speed up Magento by ~235%
September 10th, 2008 Posted in Tips, TricksWhat:
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!
31 Responses to “Speed up Magento by ~235%”
By Sam S on Sep 18, 2008
Thanks for pointing that out – simple yet effective
By Tomislav Bilic on Sep 19, 2008
Hey man. Thanks for putting the referrer source. I’m glad it helped you.
By matt on Sep 30, 2008
made little difference to us, thanks anyway.
By Dgiouzelis on Oct 12, 2008
Hello there,
this work for me, but i cant tell you the % of increase..
but its faster!!!
Thanks master
By Reno on Nov 11, 2008
This worked for me! 80.77% increase. I also had to uncomment this line:
############################################
## enable resulting html compression
php_flag zlib.output_compression on
By Lasse on Feb 9, 2009
Worked but not nearly 235% — but step by step. Trying to find other things to optimize as well.
Thank you for this.
By Silverback on Mar 21, 2009
Thanks! I hope this helps!
By adam on Mar 24, 2009
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.
By neo on Apr 7, 2009
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.
By luca on Apr 15, 2009
nice, 71% faster.
Was dead slow before but now works pretty nice
By Alice on May 5, 2009
It doesn’t work at all… It’s still slow…
By John on May 6, 2009
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.
By Neovirtua on May 29, 2009
wow, has definitley speeded the site up thanks, but the compression checker still says its not gzipped.
Thanks anyways
Marty
By Alexander Baskhanov on Jul 9, 2009
Im kinda new to magento, could anyone tell me where .htaccsess is located ?
By Alexander Baskhanov on Jul 9, 2009
Will this work on litesped servers ?
By Matt on Jul 16, 2009
Simply amazing trick!!! That made a HUGE difference
By Gerbil on Jul 22, 2009
Cheers.
This should just be an automatic thing that is checked for and applied if available during installation – crackers!
By Chris Davies on Jul 23, 2009
Absolutely incredible. WHAT A DIFFERENCE! Thanks for this, but why oh why isn’t this implemented as standard!??? Cheers again!
By Pon on Aug 9, 2009
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?
By Pon on Aug 9, 2009
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
By Scott on Aug 26, 2009
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.
By Suricate on Oct 14, 2009
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..
By Zeno on Dec 13, 2009
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!
By fred perry on Feb 19, 2010
really helping man 200% easy thanks!!!!
By Coffee Pods on Feb 23, 2010
still not working for me
By Unique Gift Ideas on Apr 26, 2010
Thanks for the solution. worked great
By Mark on May 21, 2010
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?
By Kat on Jun 9, 2010
It gained 80% of it’s speed!!!
Thanks it finally feels like a “normal” page!!
Sooooooooo relieved!
By Pulkit on Jul 1, 2010
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
By Duarte on Jul 23, 2010
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?
By John on Jul 27, 2010
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