Want to subscribe to topics you're interested in?
Become a Member

Magento Speed Up Magento 2 Guide

Discussion in 'Ecommerce / Shopping cart usage' started by Goivvy_Developer, May 14, 2019.

  1. Goivvy_Developer

    Goivvy_Developer New Member

    May 8, 2019
    United States
    Local Time:
    3:12 PM
    Hi all,

    I was looking through the forums recently and I found that a lot of people have trouble with Magento site speed, specifically Magento 2.

    I would like to share 5 quick tips that you can use to improve your Magento site speed.
    1. Optimize TTFB
      For those that don't know, TTFB (Time to First Byte) measures the time that it takes for a site to show on the screen. Essentially, when a site loads, users see a blank white screen. TTFB measures how long your users see that white screen before they see your site. An ideal TTFB should be at 200 milliseconds.
    2. Never Use JS Bundling
      Contrary to popular belief, bundled JavaScript files actually take longer to load as opposed to many, small, JavaScript files.
    3. Use Varnish
      Varnish works faster than a built-in cache. M2 has native support for Varnish.
    4. CSS Optimization
      You can optimize your site's CSS by placing your above-the-fold content hight in your HTML and moving all the other CSS resources to the bottom of the page. You will also have to make sure that your CSS and JavaScript files are minimized.
    5. Run Store in Production Mode
      There are three modes in Magento 2: Developer, default, and production. Production mode is the fastest loading mode for any Magento 2 stores.
    For more resources, you can check the links below and please feel free to leave any comments if you have any questions:
    Speed up Magento - The Ultimate Guide (Updated 2019)
    Speed up Magento 2: The Ultimate Guide (Updated 2019)

  2. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    5:12 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Thanks for sharing your insights :) This forum definitely needs more Magento experts as I have only ever used Magento for test install for write up at How to install Magento 2.2.2 on Centmin Mod Nginx LEMP Stack so no practice real world live/production experience heh.
    This is most important from my limited tests of Magento 2's inbuilt full page file and redis cache vs it's full page Varnish cache support from my benchmarks here and here. Magento 2 is very slow out of the box unless you use full page Varnish caching.
  3. robert syputa

    robert syputa Member

    Jan 18, 2018
    Local Time:
    3:12 PM
    1. Never Use JS Bundling
      Contrary to popular belief, bundled JavaScript files actually take longer to load as opposed to many, small, JavaScript files.
    I have zero experience with Magento but have some with Joomla and Wordpress.

    I have read and found that JS bundling should not be done as a general rule because it can cause latent performance and failed code execution issues, however, bundling of the common library and some other code which can be large in size while only limited portions of the library get used, can make sense. What would make more sense would be to reduce the unused code that is included in templates and modules or finds its way into sites over time as unexpunged code.
    This may not make sense if your situation is different. I have experimented using different levels of bundling such as trying full bundling, finding that crashed pages or was slow, then unbundling code that needed to be called upon page load or in a certain order and leaving the rest bundled. Logic can be used to do that, however, it creates a potential problem if updates change what and in what order code is being used.

    As a general rule, don't bundle. Otherwise, selectively bundle if the optimization scheme you are using provides that flexibility.
  4. tininho

    tininho Active Member

    May 22, 2019
    Local Time:
    10:12 PM