Sorry, nothing in cart.
Are you amongst those who have spent heavily on your Magento store still you are not impressed with your Magento store’s performance? In my last post Is Your Magento Store Optimized? Give Us A Call To Find Out i have written few common factors which affects your store’s overall performance. In continuity in this article i am going to give you few easy tips to enhance your Magento’s performance a little bit more. Keep in mind that Magento is a heavy package and it requires resources but based on your current hosting setup you can still improve the performance a little more.
Magento Server Setup Decisions
- Would you opt lightweight webservers like Ngnix or Lighthttpd over Apache (which is quite heavy). If your store is not going to consume features which aren’t there in lightweight web servers then using Apache is an overkill.
- CDN: Most of the Magento stores use lots of product images which can put load on your server if not fetched from CDN. But which CDN you should opt for? Akamai is one of the best but i will leave the decision on you.
- RAM: Typically your Magento store will run fine on 512MB RAM but you should keep in mind that VPS typically offers burstable RAM’s which is not guaranteed. If you are going to use PHP accelerators like eaccelerator, Xcache or APC then you should consider inducing more RAM. Based on your budget and site traffic you will be able to determine what will suit your store best.
Enable GZip Compression
GZip compression is known to improve Magento’s performance so lets see how you can gain improve performance by editing your .htaccess file. Mod_deflate allows output from your server to be compressed.
Edit .htaccess file located in your Magento’s root folder (same folder where you see folders like app, code, design etc.) replace the following lines with the code given below, around line 74
############################################ ## 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 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 Apache KeepAlives
Disable Access Time Logging
If you are running a Linux servers and have access-time logging enabled on any of your mysql, web server or cache partitions, try turning it off for improved performance. If you’re using ext3 or reiserfs there may be faster journal write methods you can use. Your web server administrator will be a better person to take decision in this regard.
Tweak Query Cache Size
Do this only if you have RAM in access of 1GB only. Following is one of our demo my.cnf, which we used but based on your current setup you should tweak this and adjust.
key_buffer = 512M
max_allowed_packets = 64M
table_cache = 512M
sort_buffer_size = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 2M
myisam_sort_buffer_size = 64M
query_cache_size = 96M
query_cache_type = 1
thread_cache_size = 8
max_connection = 400
wait_timeout = 300
You should adjust the above as per your own requirement for greater performance output.
Use Memory Based File Systems
You should start using memory based file systems like tmpfs. Use it on Magento’s var directory as Magento makes extensive use of file-based storage for caching and session storage. Using tmpfs will save all those extra disk IO cycles by storing these temporary files in memory instead of storing them on disk which is anytime slower this main memory.
Configure mod_expires Apache Module
mod_expires controls the setting of the Expires HTTP header and the max-age directive of the Cache-Control HTTP header in server responses. To enable Expires HTTP header for Magento you have to configure the following code in your .htaccess file, around line 158
ExpiresActive On ExpiresDefault "access plus 1 month"
Optimize Your Magento Template
Optimizing template files is a good idea because this is something where you should look at least once. There might be unused code, unused css, blank lines etc. removing them may bring the original file size down a little. Minify your JS and CSS files for better performance. Image compression should be taken care of. Try smush.it from Yahoo it’s a great tool for compression images.
Keep in mind that all the tips given above needs to be tweaked to your servers capacity and kind of setup you have. If you need any clarification on any of the above, please leave me a comment and let me know. Subscribe our RSS to receive latest Magento updates.