Cache is a system location, where frequently accessed data gets stored. By using Magento 2 Cache functionality sites content can load faster.
Enable cache from the System-> Tools-> Cache Management.
We highly recommend activating all the caches in your production server.
Varnish cache is the most recommended solution for your site speed improvement. Varnish is a proxy server. It is the layer in front of the server. It is useful to deliver content fast. When a visitor requests your site, then this request will not send to Magento, it’s delivered from cache. Varnish checks if visitors request for Home page, Checkout, without firing a mysql query, or without hitting any php code it delivers content from cache.
To configure Magento to use Varnish log in to the Magento Admin:
- Go to Stores > Configuration > Advanced > System > Full Page Cache
- From the Caching Application list, click Varnish Caching
- Enter a value in the TTL for public content field
- Expand Varnish Configuration and enter the specific information about your Varnish configuration
Set up Redis
Redis keeps data in the server memory (RAM) for the best performance. Redis is one of the most efficient caching mechanisms, particularly for Magento 2.
Redis allows the server to move the most frequently used page content from disk to RAM. This will increase the response rate when the user makes database and API calls or wants to load a webpage.
- Advantages of using Redis Cache
- Very fast in-memory storage.
- It can be used for php session storage.
Magento merging and bundling
Magento provides Merging and Bundling to reduce the number of server requests.Enable this setting from backend
To enable Magento’s built-in bundling from the command line:
php -f bin/magento config:set dev/js/enable_js_bundling 1
This is a native Magento mechanism that combines all assets present in the system and distributes them among same-sized bundles (bundle_0.js, bundle_1.js … bundle_x.js):
To enable Magento’s built-in merging from the command line:
php -f bin/magento config:set dev/js/merge_files 1
Client side optimization settings
To improve the storefront responsiveness of your Magento site, go to the Admin and change the following settings:
- Grid Settings->Asynchronous indexing->Enable
- Minify CSS Files->Yes
- Minify HTML->Yes
Database maintenance schedule
We Recommend performing periodic database backups for your development and production server. For better performance schedule your backups to run in succession, one at a time, and at an off-peak time.
Magento 2 has differing PHP memory requirements, based on how your system is deployed. In general, if you are setting up a single server store, we recommend configuring PHP memory for 2G. If you are setting up a site using pipeline deployment, we recommend 2 GB on your build server and 1 GB on your web nodes.
Scenarios and expected PHP memory requirements:
- Webnode serving only storefront pages: 256 MB
- Webnode serving admin pages with a large catalog: 1 GB
- Magento 2 cron indexing a site with a large catalog: >256 MB
- Magento 2 compile and deploy of static assets: 756 MB
- Magento 2 performance toolkit profile generation: >1 GB PHP RAM, >16 MB MySQL
- TMP_TABLE_SIZE & MAX_HEAP_TABLE_SIZE settings
The Magento 2 data set is delicate to the measure of the memory accessible for putting away information and files. To viably use MySQL information indexation, the measure of memory accessible ought to be, at least, near a large portion of the size of the information put away in the data set.
Follow the Magneto best practices for a faster website. This guide is helpful to understand the best practices guide and apply to your site to achieve the best performance. If any queries are related to this article then Contact Us.