How to Speed ​​Up Your Magento Ecommerce Site

Magento is a very popular and feature-rich open source e-commerce platform. Magento is fully customizable and ready to meet the user’s requirements, allowing them to create and launch a fully functional online store within minutes. Magento is known as a “heavy” e-commerce solution and if not configured properly it can be slow. Most CMS or e-commerce platforms like Magento and WooCommerce have speed issues and their performance degrades over time. In this tutorial, we will be using some tips and tricks on how you can improve the performance of your Magento ecommerce store.

1. Get the best hosting

Most of the time, no matter what configuration and how you set it up, your Magento site will still run slowly if you are not using quality hosting services or were unable to to order a site in a trusted company. We do not recommend choosing shared hosting. Make sure your hosting provider supports Magento and knows what they are doing. Ask to optimize your server for you. Always choose an SSD server. Get a more powerful Linux VPS with more RAM.

2. Some server tweaks you can do

We will list possible solutions to ensure high Magento performance:

  • Keep your server and software up to date. You can even automate the update process.
  • Use opcache (when using Apache, disable Suexec, suphp, ModSecurity, etc., all resource intensive modules)
  • Optimize / fix your database regularly. You can use mysqlcheck to do this.
  • Use Redis and Varnish cache.
  • If possible, use SSL + HTTP / 2 (depends on OpenSSL version). You can purchase an SSL certificate or order SSL for free.

2. Keep Magento up to date

While frequent software updates may annoy some users, it is very important to always run the latest version available. Not only will you get more features and bug / security fixes, but Magento works better with every update.

In order to ensure that hackers cannot use known threats to your site, it is important that the latest version is always installed.

3. Inclusion of flat product and category data

Login to Magento backend admin, go to System >> Configuration, select directory from Catalog >> Frontend menu. Set to Yes “Use flat catalog” and “Use flat catalog of goods”.

4. Combine (minify) CSS and Javascript files

The following settings will combine (Minify) CSS and Javascript files, which in turn will minimize HTTP requests, making response times even faster:

Select System> Configuration, Advanced> Developer> JavaScript Options. Set “Combine JavaScript Files” to “Yes”

Select System> Configuration, Advanced> Developer> CSS Settings. Set “Combine CSS Files” to “Yes”

Combine (Minify) CSS and Javascript Files

Remember to clear your cache after you’re done.

5. Browser caching

Browsers can cache files for faster access. You can take advantage of this to lower the start of render time.

The configuration depends on your server:

5.1 Browser Caching for NGINX

location ~* .(?:ico|css|js|gif|jpe?g|png)$ {
expires 365d;
add_header Pragma public;
add_header Cache-Control "public";
}

5.2 Browser Caching for Apache

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

6. Gzip Compression

Enabling GZIP compression in Apache and your web server can reduce the size of HTML, CSS, JavaScript when transferring files over the network.

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

7. Image optimization

Image optimization is a must for any website. If you optimize your images properly, you won’t use any quality, but you will get better performance. Properly optimized images can dramatically improve your website’s load time. The less time the browser has to load images, the better. You can compress them before loading them with a tool like Photoshop or there are a number of extensions you can use to optimize them automatically (TinyPNG Extension, Smush.it, Compressor Extension, etc.)

8. CDN

A Content Delivery Network (CDN) is a web service for hosting external resources of your Magento: CSS / JS files, images, fonts, etc. It is needed in order for the files to download much faster than you can with your own server.

  • Use CloudFlare with HTTP / 2 support (HTTP / 2 is an asynchronous protocol that will improve load times)
  • CloudFlare can also combine JS and CSS

9. Optimizing MySQL Server

MySQL has its own “query cache” that helps generate dynamic pages and content while dramatically improving performance. This “request cache” works according to the process below. First, MySQL stores the text of the query & the results, and then when the same question is asked, the results are served quickly. Here are some recommended settings for your my.cnf file.

query_cache_type = 1
query_cache_size = 32M
query_cache_limit=2M

And also it is recommended to set the parameter for php.ini.

php_value memory_limit 128M

10. Enable compilation

In your Magento admin panel go to the right and select System> Tools> Compilation and enable it.

Enable compilation

11. Caching

Magento caches pages on the file system. You can expect to see significant performance improvements for the average Magento website with Magento caching support.

Magento caches pages on the file system

Go to System> Cache Management then select all cache types. Click Actions and select Enable. Click the Submit button.

There are other tweaks and tweaks you can make to speed up your Magento, but these are highly dependent on your server, site configuration and some other factors.

PS … If you liked this post, please share it with your friends on social networks using the buttons on the left side of the post, or just leave a comment below. Thank you in advance.

Sidebar