Building Magento 2 Website with Performance Optimization

Are you in process of building a Magento 2 site or you already have a Magento 2 site?

Whichever your case may be, there are few points you should keep in mind to build a high performance site.
It all start to happen right from the start. We present few of the points that can help you to build a website without compromising it’s performance.

Step1 : Building a Theme

We have two options here:

  • Build from scratch with either Blank or Luma as parent theme.
  • Purchase a theme and proceed from there.

First option is recommended but is comparatively a costly approach and will take more time.

Most of the smaller business opt for option 2 as this means in a faster delivery at lower cost.

When we purchase a theme we should check the theme from optimization angle.
It is recommended that you check the speed of demo site by using following tools:

  • Google speed insight
  • GTMetrix
  • Web Page Test

Nearly half of the eCommerce traffic is in mobile and this trend will only be increasing therefore it is very important to check for Mobile scores.

Important parameters to be considered are :

  • Render blocking scripts
  • TTFB
  • First paint
  • Defer unused CSS

So once the theme is checked and selected we can jump to another aspect.

Step 2 : Select your hosting environment

We always recommend a dedicated server with minimum 8 to 16 GB RAM depending on your business activities.

The business owner with budget constraint might want to go for VPS. In this case make sure you have sufficient IOPS. With VPS while the separate RAM is assigned other server resources are shared and there are time outs due to shared resources (IOPS are used to read DB and other disc) which slows down the site.

Other options can be : CLOUD

AWS, Digital ocean and many other cloud services provide ecommerce solution to your hosting problems when configured and utilized properly. Contact us and we will get in touch to provide you with economical cloud solutions which is most suitable for your business.

Step 3 : Server configuration

DDoS : Make sure that you server is having DDoS Protection. Otherwise this types of attack will reduce server performance by consuming RAM and CPU.

Firewall : is another important part of your web server as being an open port 80 many hackers,Scanners, will try to exploit your web application, Firewall will stop them by its pre configured rule sets. You can take a dedicated Hardware firewall or Linux will have an inbuilt software firewall like Firewalld or IPTables.

Mod Security : is also one of good option for WAF (Web Application Firewall) this will help to block hackers by there bad request type

Blocking Bad Bots : is also a good idea to eliminate unwanted load on servers, there are n numbers of crawlers which are not actually use full for our web application such as Yandex,Baidu,MJ12bot etc this crawlers will crawl website badly which affect server performance. You can block them by using your Vhost configuration and Robots.

HTTP2 : Is recommended for high performance, make sure that you have SSL for that as HTTP2 will work on port 443

Step 4 : Modules

Most of the developers will purchase or download a module and will install it without any audit.

Not all modules are created with optimization in mind so when a module is purchased it is necessary to check what all are added to frontend and make sure it is not resulting in render blocking or there are lots of inline js and css. These all factor result in reduced score.

Step 5 : Social Media and third party code

This results in additional DNS resolution and additional resources so these should be avoided or request should be fired at a very late stage using lazy loading concepts.

Step 6: Enhancement of website

Many a times during further enhancement the optimization points are ignored and the scores again go down. So it is the best practice to check the scores every time some modifications are done and keep a record of it.

Step 7 : Routine Health Check

Audit your access logs to evaluate actual traffic, this will help you to identify which types of request are hitting on your server.
Schedule Maldet and ClamAv Routine scan on document root, this will help to identify malicious codes or scripts on server.

Additional Recommendation :

  • Make sure Cache is effectively used.
    • Redis
    • Varnish
    • Block caching
  • Use Defer java script parsing
  • There is lots of debate whether JS should be merged or bundled or left as it is. It has been observed that there are chances that Mobile score goes down if JS is merged or bundled.
  • Remove unused CSS
  • Separate css and JS needed for above fold
  • What are the scores we expect when the sites are tested via Google speed insight
  1. Desktop Home page score : Above 92
  2. Mobile Home page score : Above 70
  3. Other pages should be in similar lines
  4. On a good network TTFB should be 0.4 seconds Max and Page time should be 3 seconds.

References :

Devdocs ( https://devdocs.magento.com/guides/v2.1/config-guide/prod/prod_perf-optimize.html )

Tools:

Google page speed (https://developers.google.com/speed/pagespeed/insights/)
GT metrix ( https://gtmetrix.com/)
Webpage Test ( https://www.webpagetest.org/ )

Are you still not sure on how can you improve your performance? Feel free to reach out to us for a free no obligation Magento 2 site performance Audit.

By |2019-01-05T13:32:18+00:00December 28th, 2018|Magento, Magento Speed Optimization, Magento-Commerce|0 Comments