I decided to write this article to help newbies magento users. Magento is a very powerful yet complex framework with many nuances that are easily overseen. Many of those are critical to the speed of a magento website. So, here is a checklist to help you remember some of the important things you need to be aware to run your magento website at “top” speed.
#1 Production mode
This is the most obvious thing to do, although I do see a lot of magento websites running in default or even development mode.
Running in production mode improves the site’s performance because it assures that all necessary static files are available at run time instead of forcing magento to dynamically locate and materialize those files on demand during run time.
Also, all errors are logged into log files instead of being displayed to the user.
To check which mode are you running in execute the following command in the magento root folder:
$ bin/magento deploy:mode:show
You will get a message displaying the current application mode.
If you are not running in production mode, you should change it right away (assuming your site has already completed the development stage). To change to production mode all you have to do is run the command:
$ bin/magento deploy:mode:set production
Note that this command will put your website in maintenance mode while it run (which usually take about a minute or so).
#2 Enable Cache
Make sure that all magento caches are enabled. This can be checked in the admin (Go to System > Cache Management) or in the command line by running the following command:
$ bin/magento cache:status
If you see that some or all cache types are disabled you can enable them running:
$ bin/magento cache:enable
Note that in production mode you can’t enable/disable caches in the admin. You will need to do it in the command line by running the above command.
#3 Use External Caches
Whenever possible use external caches like Varnish, Redis or Content Delivery Networks (CDN). This 3rd-party cache create an additional cache level that can make a big difference to the site performance.
Varnish in particular is highly recommended by magento as it sits in from of the web server and can serve many of the necessary files without going to magento.
CDN is also an option to keep in mind, specially if you have visitors coming to your website from all over the world. CDN distributes your site content through a system of servers that are designed to deliver content in the most efficient way. These servers are strategically placed around the globe allowing quick access to your content wherever your visitor is.
#4 Cron Jobs
This is also an aspect that is commonly overlooked, specially if you are not running your magento store in a magento ready hosting.
Several magento features require at least one cron job, which schedules activities to occur in the future. Without them your magento store will not work at 100%. Among the activities performed by cron job are:
- Applying catalog price rules
- Sending newsletters
- Generating google sitemaps
- Sending customer alerts and notifications (like product price changes or back in stock)
- Reindexing the database
- Sending transactional emails
- Updating currency rates
Unfortunately you can’t check your cron jobs or manage them directly in the admin without a third-party extension.
To install magento cron jobs you need to run the following command:
$ bin/magento cron:install
You can also check what cron jobs are running using:
$ crontab -l
#5 Client side optimization settings
If you are running in developer or default mode you can change some settings on the admin to improve the site’s performance. Go to Stores -> Configuration -> Advanced -> Developer and set:
- Grid Settings > Asynchronous indexing: Enable
- CSS Settings > Minify CSS Files: Yes
- Template Settings > Minify HTML: Yes
One of the most critical aspects in your hardware. You should not run magento in a shared host environment nor in a server with less than 4GB. They will just not cope with it in a satisfaying manner.
#7 Speed Extensions
This extension will:
- Optimize JS, CSS and HTML code structure
- Display pages faster thanks to the WebP images format and Lazy Loading
- Resize and Crop images for mobile devices
- Use smart JS Bundling for a significant boost
Amasty also offers FREE lifetime updates and 60 days money back guarantee.