0

Magento 2 website speed very slow as per https://developers.google.com/speed/pagespeed/insights/

Result of site:-

Reduce server response times (TTFB) - 1.68 s
JavaScript execution time - 2.9 s

enter image description here Almost 250 request sends to server. So, google page speed gives 4/100 for mobile and 46/100 for desktop.

We already enabled minify js, merge js, minify css and merge css from backend. Also, HTTP2 protocol used to send all request. We use built in cache in production mode.

We do not use Bundling because its create almost 7.5 MB file so takes more time to load resources.

Please help me to improve page speed around 85/100 for desktop at-least.

1

I see you tagged LiteSpeed, are you using LiteSpeed web server? If yes, you can take advantage of LiteMage cache to replace Magento built-in cache. The LiteMage starter option has no extra cost. Many LiteSpeed users are using this solution for their Magento 2 stores and are very happy with the results.

  • We have installed LiteMage cache and its working fast but now faced one more issues like Refused to apply style from xyz.com/pub/static/version15568038/_cache/merged/fdfaee03ad9d3fdd9c35ce5.min.css because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. Is there any configuration on server side or in theme? – Hiren Shah May 3 at 4:25
  • @hiren-Shah you will have to experiment with css merging turned off. You've cached an asset which has been regenerated elsewhere. The error means you are loading blank. – Dominic Xigen May 13 at 22:58
3

Some important points for speeding up Magento 2::

  • Production Mode
  • Full Page Cache
  • Minify JS and CSS
  • Check TTFB and try to reduce it
  • Enable Flat Categories and Products
  • Enable GZIP compression
  • Never Use JS bundling
  • Upgrade to latest(stable) PHP version
  • Use Varnish Cache instead of built in Magento cache. (optional)
  • Image optimization
  • Check every 3rd-party extensions (Avoid conflicts between 3rd party extensions)
  • Upgrade hosting to fasted server
  • Check code SQL query execution time (optimize queries)
  • Enable profiler and check the time.
  • Use CDN (Content Delivery Network)
  • Check your website speed in waterfall

May be this link will help you in details:

  • Check compatibility of php against magento version. Also I wouldn't recommend switching to flat categories and products. Very few smaller developers test their code against stores with flat tables enabled which means things will break. – Dominic Xigen May 13 at 23:01
0

Please follow the points mentioned on Above answer of #Saphal Jha.

Further more follow the following points.

  1. Make sure any block has not configured cacheable=false in any layout xml for given page. because it prevents whole page from full page cache.

  2. You can use magento profiler or Mgt-developer toolbar to debug execution time for each block and collection queries.

  3. Make sure there are not that much use of object manager to create instances in template files (.phtml).
  4. Based on profiler or dev toolbar try to reduce execution time for particular block or collection (it may happen there is select * queries or multiple queries are there which may unnecessary).
0

Your server response is slow, you need to speed up that. The best and easy way to speed up the magneto website is page cache. But beside page cache, you can do the following to improve server response.

  1. Inspect every installed 3rd-party extension, and disable useless extensions on your website
  2. Choose the fastest hosting you can afford
  3. Turn Production Mode On
  4. Never Use JS Bundling enter image description here
  5. Enable CSS/JS Minification enter image description here
  6. Last and most importantly, enable profiler and check all the files (.phtml) and events, check which are taking more time to execute. And remember even 0.5 sec for a file or event is also huge time for a single file/event.
0

Someone has previously touched on CDN but if you have the budget I recommend worldwide distribution system like Cloudflare. Their edge cache and features such as RailGun/Rocketloader offer huge improvement. This plus the worldwide distribution helped us loads on a busy site.

In my experience the more caches in place the more time is spent in development punching holes through the cache getting dynamic content to load. You can handle this in Cloudflare with page rules but they soon add up. Plus all the extra development time required. So choose wisely.

That said a Magento store that loads in under 5 seconds is a fast one. Magento by it's very nature is slow.

0

Increase the Magento 2 Site Speed by the following ways

  1. Use of Profiler to check the time taken for files to load, especially for third party modules and your custom modules. Check and ensure to load them in lesser time.

    php bin/magento dev:profiler:enable html

    php bin/magento dev:profiler:enable csvfile

  2. Minify your HTML, CSS and js files.

  3. Merge your CSS and JS files.

  4. Optimize and scale your images.

  5. Switch your website to production mode.

  6. Make sure you compress your files through Gzip.

  7. Optimize your server to reduce the server response time.

  8. Check if bundling works to reduce the loading time if it increases the page size disable it.

  9. Also, try using Google Page Speed Module in your Server so you can configure it in the best way to load your site in short span of time. You can also optimize and convert images to best fit for your site.

Since you have tried all sorts of optimization, I believe it will be difficult for you to enable profiler and optimize the code.

I would recommend you to install Google Page Speed Module in your server where you can configure the optimization to speed up the page as well as increasing your google page speed score significantly even 100/100. To see if this can solve all your problems https://developers.google.com/speed/pagespeed/module/

If you are using apache, it will be easy for you to install and configure whereas for nginx it would require more knowledge for setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.