What do we love in Magento? Its amazing functionalities.

What do we hate in Magento? Its pathetic slow speed.

Speed Up your Magento store from slow to insanely fast

Well, if we are using a shared hosting environment and we are using Magento’s default configurations without setting it up for optimal performance, then we can’t really blame Magento for that. Magento has various setting which can boost up the speed. Let’s see how we can do that.

Editing .htaccess file:

Some secret of Speeding up Magento is hidden in its .htaccess file itself.

Enable Output Compression:

Remember this will work only if mod_deflate apache module is already installed in your server. The following section will turn on the module. What it does is compress text, css, and javascript before it is sent to the browser. This results in a smaller download size of all the components for the browser, so our Magento pages loads faster. To enable output compression, find the following lines in you .htaccess file and just uncomment the appropriate lines, which will finally look like following:

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

    # Insert filter on all content
    SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
 
    # 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

Enable Expires Headers:

Expires Headers are used by browser to determine how long a page component can be cached. Expires headers are most often used with images, but they should be used on all components including scripts, stylesheets, and Flash components.

Keep in mind, if you use a far future Expires header you have to change the component’s filename whenever the component changes. Using a far future Expires header affects page views only after a user has already visited your site. It has no effect on the number of HTTP requests when a user visits your site for the first time and the browser’s cache is empty. By using a far future Expires header, you increase the number of components that are cached by the browser and re-used on subsequent page views without sending a single byte over the user’s Internet connection.

integrate-magento-with-erp-appseconnect

Find the following line in your .htaccess file and uncomment the line if it’s commented and add “ExpiresActive on” above it.


############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
    ExpiresActive On
    ExpiresDefault "access plus 1 year"

Disable ETags

ETags are a way for browsers to validate cached components across subsequent visits. They can slow down a site served from a cluster if the cluster hasn’t implemented them properly. It is best to just turn them off by setting “FileETag none”.

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags
 
    FileETag none

Change default setting from Magento Admin:

Till now we did all the changes in Magento .htaccess files. Not lets concentrate on the Magento Admin settings.

Merge CSS and Javascript files

The following settings will merge the CSS and Javascript files, which in turn will help minimizing the http request and making the response faster:

  • Magento admin -> System Configuration -> Developer -> Under “Javascript Settings”, change “Merge Javascript Files” to YES.
  • Magento admin -> System Configuration -> Developer -> Under “CSS Settings”, change “Merge CSS Files” to YES
  • Clear cache

Enable Flat Catalog

Magento uses the EAV model to store customer and product data. Enabling the Flat Catalog for Categories and Products merges product data into one table, thereby improving performance by responding to queries faster. If your store have more than 1000 products. You should enable Flat Catalog Products.

  • In the Magento Admin, go to System > Configuration > Catalog.
  • Under “Frontend”, change “Use Flat Catalog Category” to YES.
  • Under “Frontend”, change “Use Flat Catalog Product” to YES. (optional)
  • Clear the cache.

Enable the Magento compiler

Important Note: May break your store if custom extensions are being used. So don’t blame me. I warned you.
Magento’s application files are searched in the following order:

  • app/code/local
  • app/code/community
  • app/code/core
  • lib

This search is performed everytime a page loads, resulting in a lot of filesystem reads. The Mage_Compiler reduces the number of reads by copying all of the application files to a single include directory. It also caches the most frequently used pages.

1. In the Magento Admin, go to System > Tools > Compilation.
2. Click “Run Compilation Process”

Log cleaning via admin

1. In the Magento Admin, go to System > Configuration.
2. In the left menu under Advanced, click System.
3. Under “Log Cleaning”, change “Enable Log Cleaning” to “yes” and configure the Save Log for 14 days:

magento

Clean Magento database

You can manually clean up from database by logging in to your Magento database, and truncating the following tables:

  • log_customer
  • log_quote
  • log_summary_type
  • log_url
  • log_url_info
  • log_visitor
  • log_visitor_info
  • log_visitor_online

This is just a few simple things that we can do to make our site faster. Along with the things discussed so far, if you also use the following, I can personally guarantee that your store will be insanely fast.

1. Take a dedicated SSD hosting server.
2. Use external cache such as Varnish.
3. Use CDN for your site elements.

The main conclusion is, you need to configure your Magento system and get a high performing hosting server properly optimized to get an awesomely performing Magento ecommerce store.

If you think I need to add something else to the list, don’t hesitate to write it in the comment and also let me know if you have questions regarding Magento speed. Ciao.

integrate-magento-with-erp-appseconnect

You may also like:
Magento 2.0 Advanced Pricing
Top 7 Magento Extensions in 2017 for Your eCommerce Store
How to Maintain Multi-Warehouse Stock in Magento?