Customer experience is an important factor that influences sales. If the loading time is too long, customers might decide to move on and search for another seller.
There are a lot of factors that decides website loading time, such as the hosting, the core code of Magento, third party extensions, and the traffic. Before jumping in to the work, it is a good idea to know the current condition of your store. By using your web browser or third party websites, you can get the idea of what your customers are experiencing. There are various ways to check your website speed, and this is a few that you can use easily: Google Pagespeed, Gtmetrix, Pingdom, or Lighthouse on Chrome browser.
These are several tips that might come in handy when setting up your Magento store:
1. Use production mode
Magento 2 has three modes of operation: default, developer, and production. Unlike developer mode where files are generated on the fly to make sure you can see the changes the developer have just made, on production mode static files are cached so that the server is not busy creating same files for different customers. This results in better customer experience and lower server load.
2. Upgrade Magento core application and dependencies packages
Technology evolves, betters ways to do a job are created continuously. Magento has an active release cycle because it is supported by many open source developers and by Adobe. If your store is using custom extensions, you might need to do a bit more checking, but using composer, upgrading Magento and dependencies nowadays have been much more easier.
3. Use Redis and Varnish
Redis is an in-memory data structure used as a database, cache, message, broker, and streaming engine. By using Redis, you can quickly store your data in memory
Varnish is an HTTP accelerator designed for content-heavy dynamic web sites and APIs. By using Varnish, you can lessen the load of your web server because Varnish will handle similar request without asking the web server multiple times.
4. Optimize Images
Based on a report by Akamai, 63% of all web pages weight comes from image. This is a significant extra load for your website if not handled properly. From resizing the image to fit the actual display size to choosing the next gen format such as webp, image optimization can help your website to load faster.
5. Make use of Content Delivery Network (CDN)
6. Minify and merge / bundle resources
7. Manage your database and file logs
After running your store for a while, your data will only get bigger and bigger. If you do not put any attention to them, it might cause your server to be full and unable to handle any operations. To prevent this, you can utilize logrotate and setup Magento database message queue cleanup. There are also manual data collection you might need to clean up manually if you enable them, such as viewed product report.
8. Choose the right server specification
Besides the minimum system requirement of Magento itself, it is important to choose your specification based on your market location, how many visitors on daily basis, or maybe you are running a flash sale. These things can contribute in getting a balance between cost and performance.