CodeClouds Color Logo CodeClouds White Logo

In order for Magento to work properly for larger loads, performance optimization is needed. In this blog, we give you 10 ways to help improve the performance of Magento.

A well optimised site is important for customer experience. A slow site can lead to lost customers as well as customers not browsing as many pages of your site. There’s also a trust factore for speed when it comes to payment processing. More than 40% of consumers will abandon a website if it takes more than 3 seconds to load. This may not seem like a long window, but first impressions are important, and if they’re clicking through google results, they will simply click the next one. This means that page load speed directly impacts your conversion rate.

magento optimization tips
 

Optimizing your magento installation will lead to a snappier site which will enhance the experience of your customers.

A optimized website is bound to enhance the performance and the speed of the eCommerce experience. This will help you engage more and more customers and get the maximum revenue. The revenue of an eCommerce store solely depends on the conversion and when you own a CMS platform like Magento, conversion comes easily. An eCommerce website with proper Magento performance optimization can guarantee you more revenue. Here are few performance optimization tips for Magento, in order to make sure that you get the enquiry turned into conversion every time:

Hosting Environment

You need to make sure to choose a hosting plan that can handle the amount of traffic you get normally, and during unexpected peaks. First, make sure your server is geographically located near where you expect the majority of your clients to be.

Next, make sure to pick a provider that is able to scale with your amount of traffic. Finally, make sure they are keep acceptable uptime levels.

Gzip Compression

Enabling gzip compression in your .htaccess file gives a noticeable speed boost. You also need to look into having a CDN (content delivery network) set up. This will reduce the direct load on your site during high traffic as well as save bandwidth for your hosting.

Database Caching

You should also look at configuring database caching.

There’s built in caching in Magento, but you’ll want to use a 3rd party caching tool for best results. Something like Varnish can give you a speed boost of up to 80%.

To configure built in database caching, do the following-
In your Magento install directory, locate “di.xml” in the /app/etc/ directory.

Locate 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_options" xsi:type="array">
                <item name="cache_dir" xsi:type="string">page_cache</item>
              </item>
          </item>
      </argument>
   </arguments>
</type>
<type name="Magento\Framework\App\Cache\Type\FrontendPool">
   <arguments>
      <argument name="typeFrontendMap" xsi:type="array">
        <item name="full_page" xsi:type="string">page_cache</item>
      </argument>
   </arguments>
</type>

 

Replace it with this

<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>

 

Where it says “place cache id here”, place a unique cache identifier.

Page Cache

In Magento 2, Under “System” and “Cache Management”, make sure cache management is enabled.

Varnish

A better option than the built in caching tools, refer to our video below to set it up with Apache or NGINX

 

Magento Database Optimization

Another important factor for the performance of your Magento storefront is database optimization. By using database indexing, you can increase performance by minimising the number of disk accesses.

In addition to database indexing, there’s query caching. In the case of Magento, there’s a very low write workload while there are more complex SELECT statements while having low concurrency. While in a lot of cases, query caching can hurt performance on certain heavily multithreaded loads, in this case it can greatly help performance.

Getting it setup right is important. First, you typically don’t want it larger than around 100-150MB. This isn’t only about the amount of memory your server has, it’s about the overhead of maintaining and pruning the cache.

Be cautious about sizing the query cache excessively large, which increases the overhead required to maintain the cache, possibly beyond the benefit of enabling it. Sizes in tens of megabytes are usually beneficial. Sizes in the hundreds of megabytes might not be. -MySQL Documentation

Another problem is it is now deprecated, and not available in newer MySQL versions. In place of it, you can use ProxySQL, according to the documentation.

Flat Tables

Using flat tables in magento gives a performance boost.

To enable flat tables in Magento 2, in your admin panel go to Stores > Settings > Configurations.

Select Catalog > Catalog in the left panel. Open the storefront section. From there, enable both “Use flat catalog Category” and “Use Flat Catalog Product”

Magento Compilation Feature Integration

It is better to install a composer of Magento and compile the files to make a static resource in your system. This makes the accessibility of the browser easier.

Code Optimization

Using the PHP accelerator extension offers a performance boost here. You should also disable all PHP or Apache modules you don’t use.

If you’re storefront is running custom code, evaluate and simplify it, frontend and backend. Spaghetti code can also affect page load times, so making sure it’s professional written is important. There are several Magento specific PHP optimization tips and best practices online if you don’t know where to start.

Version Upgrade

Make sure you are on the latest release of your Magento version. Upgrading to a completely new version is a difficult process that involves making sure all of your extensions are compatible with the new version as well as everything working in general. In that case it’s suggested to set up an Identical test site to minimize downtime.

Even sticking with the same Magento version (which is perfectly ok) you can update to the latest release, getting the latest bug fixes and performance improvements.

Auto Scaling

As mentioned before the in Server and Caching section, your server needs to scale with peak traffic. Having a plan for this can help you with the expected traffic surges like the holiday season, and unexpected surges that can result in costly downtime or a slow down. Make sure you have some sort of auto scaling plan.

Extra extensions

Get rid of any Magento extensions you don’t use. Some Magento extensions cause extra bloat that while acceptable if they are performing and important function, really an add up if you are culling your unused extensions.

Standardize The File Size

Reduce the size of resources that have to be commonly fetched. Minify any client side code. Compress images. There are some extensions to do this for you, but this can even be done manually.

Your theme images, product images, and more really add up. Compress these images as much as you can without sacrificing quality. Jpegs for product images are fine, and higher compression is typically ok here.

For your theme, you’ll encounter images with solid colors and simple gradients. Often, these are actually smaller in the form of lossless compression formats like PNG than interlaced formats like JPEG without extremely lossy compression. Experiment with this to find the optimal compression strategy.

Merge the Javascript and CSS files

In your admin panel, you can elect to combine your CSS and javascript. This reduces load times of your website by making less requests and slightly smaller transfers, and for pretty much no extra work this option is a no-brainer.

If you need your Magento site optimized or built by someone, CodeClouds has the expertise you need with over 250 members worldwide. Our Magento Developers can get your storefront working with the performance you need to pull in and keep customers. Contact us today!