21 Tips to improve Magento 2 Application performance
- Production Mode
– Run below command in terminal to get current application mode:
$ bin/magento deploy:mode:show
– Now set the application mode to production:
$ bin/magento deploy:mode:set production
It will take a while to switch the mode
If you want to skip the compilation for any reason use below command :
$ bin/magento deploy:mode:set production -s - Minify JS and CSS
- Check TTFB and try to reduce it (check the time using magento profiler)
- Enable Flat Categories and Products (Sometimes Risky)
- Enable GZIP compression
- Never Use JS bundling (As suggested by Magento best practices)
- Upgrade to latest(stable) PHP version and use OPcache
- Use Varnish Cache instead of built in Magento cache. (optional)
- Image optimisation
- Check every 3rd-party extensions (Avoid conflicts between 3rd party extensions in console)
- Upgrade hosting to fasted server (never used shared hosting for magento)
- Check code SQL query execution time (optimize MySql queries)
- Enable profiler and check the time (use IP restriction mode).
- Use CDN (Content Delivery Network) if there are bulk and heavy images in your store.
- Check your website speed in waterfal, use defer
- Disable unnecessary module (you can also disable magento code modules if not needed by keep check class dependencies)
- Remove cacheable=”false” from XML that will prevent page caching (User Private Content instead of disable the cache for the page)
- Use AMP (Accelerated Mobile Pages)
- Update Magento 2 version to the latest and stable
- Use APIs instead of controller for specific actions
- Use elastic search instead of MySql
Some website URL where you can check you website speed:
- https://developers.google.com/speed/pagespeed/insights/
- light house testing : https://developers.google.com/web/tools/lighthouse
- https://www.webpagetest.org/ , https://gtmetrix.com/ , https://tools.pingdom.com/
- Check website from multiple locations https://geopeeker.com/