CodeClouds Color Logo CodeClouds White Logo

In this video we’ll go over a few quick tips to optimize your magento storefront. There are some basic things you can with your Magento installation that will give an immediate performance improvement.

We cover the following things in this video:

Page Cache

Ensuring page cache is properly enabled prevents the site from having to re-generate a page every time it’s needed.

Flat Tables

Enabling flat tables provides a performance boost by making it faster to retrieve product information from the database.

Merge and Minify Javascript and CSS

Merging and minifying our javascript and CSS files means that we will have lest requests to server and less data to deliver. Though this somewhat overlaps with Gzip compression, this performance boost also works for browsers that don’t support Gzip compression.

Gzip Compression

Gzip compression will reduce the size of what the server has to deliver by 50% or more typically. This is because the server compresses it before sending it, and the end users browser unpacks it. With a large amount of concurrent customers, this can provide huge performance gains.

You’ll need the following rules for this section of the video

AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/x-javascript

AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

And this code block

<Directory /var/www/html/>
<IfModule mod_mime.c>
AddType application/x-javascript .js
AddType text/css .css
</IfModule>
<IfModule mod_deflate.c>
 
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/plain text/xml application/javascript
 
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
</IfModule>
</IfModule>

Header append Vary User-Agent env=!dont-vary

</Directory>

 

Database Caching

For best results, you’ll want to use a 3rd party tool like Varnish. Magneto 2 does come with a built in database caching, and that is better than no caching.

In the video, you’ll need the code below for this section

<type name="Magento\Framework\App\Cache\Frontend\Pool">
<arguments>
<argument name="frontendSettings" xsi:type="array">
<item name="page_cache" xsi:type="array">
<item name="backend" xsi:type="string">database</item>
</item>
<item name="place cache id here" xsi:type="array">
<item name="backend" xsi:type="string">database</item>
</item>
</argument>
</arguments>
</type>
<type name="Magento\Framework\App\Cache\Type\FrontendPool">
<arguments>
<argument name="typeFrontendMap" xsi:type="array">
<item name="backend" xsi:type="string">database</item>
</argument>
</arguments>
</type>

 

Outside of what’s discussed in the video, there are a few things you can look at as well, like making sure your hosting environment is the right choice for your needs, and making sure your code is optimized.You can find a full written article on Magento 2 performance optimization here.

If you need a Magento storefront built or your existing one maintained or optimized, you can rely on the expert Magento developers at CodeClouds! Contact us today to learn more.

If you are looking for a career in Kolkata as a Magento Developer, apply through our careers page.