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 not only for Google but mainly for the User Experience (UX) on your site. Research from Google and Microsoft shows that slower websites convert less and that the effect of a slow website is lasting.
Sidenote: As a psychologist this might be a form of Déformation professionnelle, but I kinda hate it when people always talk about optimizing for search engines/ Google. Don’t optimize for them, keep in mind that you optimize for your users!
Ok, so nothing new so far (I think), but what about the speed of your Magento platform? If you’re serious about e-commerce, 9 out of 10 times Magento will be your best choice overall. But there are some complaints about Magento being a very slow system and as I just explained: that isn’t good for your UX. And although most of these complaints aren’t fair (off course you’re Magento site is slow when you put it on a cheap shared hosting with 200 other websites!), we all know that of the box Magento isn’t the fastest boy in the class. So that’s where this list comes in…
Below is the list with 101 ways to speed up your Magento site… Well ok, at the moment I have only 30 45 ways, but if you help me out we can make it to 101! When new suggestions come in, I’ll update this post with additional ways to speed up your website. When more tips come in I’ll probably start categorizing them to maintain an overview.

The tips:
A) Hosting environment/ General tips
- Get a dedicated server
- Host your site in the country where your customers are.
- Don’t host files on your web server that you do not use, large or small.
- Goto MySQL Admin and select all the tables and repair and then optimize them
- Use a PHP accelerator like APC or ZendOptimizer+
- Use Apache mod_expires and be sure to set how long files should be cached. You could use the example below for your Apache virtualhost config:
# Turn on Expires and set default to 0 ExpiresActive On ExpiresDefault A0 # Set up caching on media files for 1 year (forever?) ExpiresDefault A29030400 Header append Cache-Control "public" # Set up caching on media files for 2 weeks ExpiresDefault A1209600 Header append Cache-Control "public" # Set up 1 week caching on commonly updated files ExpiresDefault A604800 Header append Cache-Control "proxy-revalidate" # Force no caching for dynamic files ExpiresActive Off Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" Header set Pragma "no-cache" - Enable Gzip Compression in htaccess
- Compress output, use zlib.output_compression or mod_deflate
- Use a Content Delivery Network (CDN) for parallel transfer of static content. There is a Magento extension that can help you do this with category and product images: the One Pica Image CDN. But… (see next tip)
- Don’t use too many different external sources (for images, iframes, (twitter)feeds etc.) because every DNS lookup takes extra time.
- Enable Apache KeepAlives: Make sure your Apache configuration has KeepAlives enabled. KeepAlives are a trick where multiple HTTP requests can be funneled through a single TCP connection. The setup of each TCP connection incurs additional time, this can significantly reduce the time it takes to download all the files (HTML, JavaScript, images) for a website. More info at Apache.org.
- Minimize redirects
- Make your output W3C compliant. Errors slow down the browser.
- Swap Apache for NginX or Litespeed. If this isn’t an option, then go for Zend Server (ideally the non-CE version so you can use full page caching).
- Turn off or at least reduce web server logging (reduces disk writes)
- Disable Access Time Logging. Magento Wiki: For Linux servers, if you have access-time logging enabled on any of your mysql, web server or cache partitions, try turning it off for a performance boost. If you’re using ext3 or reiserfs there may be faster journal write methods you can use. For more info see Linux.com.
- Compile MySQL from source instead of your OS’s package manager (can yield significant MySQL performance gains)
- Always upgrade to the latest Magento version. Not only will you get more features and bug- and security fixes, but with every update Magento performs better.
- Query Cach size: Magento Blog: Modify the configuration for your MySQL server to take better advantage of your server’s RAM. Most Linux distributions provide a conservative MySQL package out of the box to ensure it will run on a wide array of hardware configurations. If you have ample RAM (eg, 1gb or more), then you may want to try tweaking the configuration. An example my.cnf is below, though you will want to consult the MySQL documentation for a complete list of configuration directives and recommended settings.
- set ‘php_value memory_limit 128M’ in your php configuration or add it to your .htaccess file to ensure you don’t run out of memory.
- Use a memory-based filesystem for dynamic data. If you store dynamic data (var/cache, var/session) on RAMdisk or tmpfs, the disk I/O is decreased.
- Change realpath_cache_size in php.ini
realpath_cache_size=1M (careful, this is per apache process)
realpath_cache_ttl=86400 (ok for production site) - Memcache (for the hardcore) is documented in http://www.magentocommerce.com/boards/viewthread/9037/ and more tips from http://alexle.net/archives/275 to get you up and running.
- Disable the PHP open_basedir directive. Read this.
B) Template
- Optimize all your (template) images – Most if not all should be at least below 10kb
- Crop the white space using your image editor
- Use PNG8 Files or GIF files rather than Jpegs and don’t use transparency (depending on how many colors you use and how large the image is, but try for yourself)
- Scale images: make images in the dimensions you need and not resizing them in the editor
- Use image compression (you can use smush.it to do it for you)
- Use CSS Sprites, there even are CSS Sprite Generators
- Minify your Css, remove unused code
- Minimize Javascript use.
- Use a lightweight template as a basis for your template. For example: the Yoast Blank SEO theme.
- Specify Image dimensions
- Use Block cache and HTML output in your extensions
- Apply Javascript Lazy Loader for prototype
C) Magento configuration
- Uninstall any extensions that you don’t actually use
- Enable all Magento Caches: System -> Cache Management
- Use an offsite Stats Tracker like Google Analytics and not an onsite one
- Combine Javascript and Combine CSS files: System -> Advanced -> Developer -> ‘Javascript settings’ and ‘CSS Settings’. You can also consider using an extensions to do this like the Fooman Speedster extension, whichever works best for you.
- Try some of the Magento performance extensions.
- Enable the Magento Flat Catalog and feature when you have a small shop.
- Don’t use layered navigation if you don’t really need it, it’s resource intensive.
- Use Magento’s Compilation feature it’s reported to give you a 25%-50% performance boost: System > Tools > Compilation
- Use the correct session storage. The choice is either database or files and the best setup depends on your system setup so be sure to test which one works best for you
- Limit the number of products on a product overview page.
- Set only those attribute frontend properties to ‘Yes’ that you’re actually going to use. Set all other to ‘No’. Don’t use in quick search, advanced search compare, etc etc.: Catalog -> Attributes -> Manage Atributes -> Frontend Properties
- Disable the Magento log: System -> Configuration -> Advanced -> Developer -> Log Settings (default is disabled)
Enterprise only tip:
- Disable Enterprise_CatalogEvent. Go to Admin -> System -> Configuration -> Catalog -> Catalog Events
Then you want to turn off the following- Enable Catalog Events Functionality
- Enable Catalog Event Widget
D) Speed testing, analysing, monitoring
- Run your site through websiteoptimization.com
- Use Google Page Speed Firefox extension or Yahoo Yslow for some tips from Google and Yahoo
- Speed monitoring and downtime alerts
Bonus Tips
(because it doesn’t actually speed up the frontend but only the backend):
- Use K-Meleon if you are on Windows for your general Admin work. It renders Magento’s heavy JS back-end significantly faster than any other browser.
- Use the GoogleGears extension from Yireo.com to cache static files locally.
I do realize that you probably can’t use all of the above tips but it’s not about using them all, and sometimes you just make the choice to give a functionality a priority over performance and that’s OK. If you can only apply some of them you will still increase speed and gain in user experience. And remember: because speed depends on many variables, some of the tips might not have an impact on your website at all while others can have a huge impact. So always test the impact of every step you take and take actions accordingly.
Do you have any tips? Post them in the comments and I’ll add them to the list!
Sources:
My own experience
| Google Page Speed | Inchoo | Yireo.com | Yoast.com | Dries Bultynck | Piotr Kaminski | Magentocommerce forum thread about these tips
Related posts:


{ 12 comments }
Excellent optimization tips, thank you. i didn't knew about K-Meleon, i am going to try it now.
Excellent optimization tips, thank you. i didn't knew about K-Meleon, i am going to try it now.
Very helpful, I'm surprised that Magento's mini icons aren't sprites as standard.
Very helpful, I'm surprised that Magento's mini icons aren't sprites as standard.
These are really, really great suggestions! I've bookmarked this list so I can go through them and get my Magento install working as fast as possible.
These are really, really great suggestions! I've bookmarked this list so I can go through them and get my Magento install working as fast as possible.
Thanks, let me know if you have additional suggestions!
Thanks, let me know if you have additional suggestions!
Compiling MySQL from source is pretty pointless as it's already highly optimized. Compiling Apache or PHP from source has it's benefits but MySQL almost nothing.
Compiling MySQL from source is pretty pointless as it's already highly optimized. Compiling Apache or PHP from source has it's benefits but MySQL almost nothing.
Good tips, well organized. Thanks for sharing
Good tips, well organized. Thanks for sharing
{ 13 trackbacks }