Magento 2 Configuration Best Practices for Optimal Performance Last Updated on 19 July 20234 August 2025 Mark Mac Magento Setting up and configuring an e-commerce store on Magento 2 can be a complex task. To maximize the potential of this powerful platform, it’s essential to implement best practices for Magento 2 configuration. This blog post will offer insights into Magento 2 configuration best practices, covering cron jobs, indexers, caches, and more. By following these practices, you can ensure that your Magento 2 store runs smoothly, attracts more visitors, and converts them into loyal customers. Get ready to unlock the full potential of Magento 2 and take your e-commerce store to new heights. Table of Contents Toggle 1. Cron Jobs2. Indexers3. Caches4. Asynchronous email notifications5. Asynchronous order data processing6. Client side optimization settings7. Bundling tips8. Database maintenance scheduleWrap Up 1. Cron Jobs Install Log in as, or switch to, the file system owner. Change to your Commerce installation directory. Run commandbin/magento cron:install [–force] To view the crontab, enter the following command as the file system owner crontab -l A sample follows: #~ MAGENTO START c5f9e5ed71cceaabc4d4fd9b3e827a2b * * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/magento2/var/log/magento.cron.log #~ MAGENTO END c5f9e5ed71cceaabc4d4fd9b3e827a2b Remove the Commerce crontab bin/magento cron:remove Run cron from the command line bin/magento cron:run [--group="<cron group name>"] Ex: bin/magento cron:run --group index bin/magento cron:run --group default Logging By default, the cron information can be found at <install_directory>/var/log/cron.log. 2. Indexers Update on Save Config in System > Tools > Index Management The Update on Save mode immediately indexes whenever your catalog or other data changes Update on Schedule (Recommend) Config in System > Tools > Index Management The Update on Schedule mode stores information about data updates and performs indexation by portions in the background through a specific cron job 3. Caches System > Tools > Cache Management We highly recommend using Varnish, as it is an efficient production page cache solution. 4. Asynchronous email notifications Go to Stores > Settings > Configuration > Sales > Sales Emails > General Settings > Asynchronous Sending Enabling the “Asynchronous email notifications” setting moves processes that handle checkout and order processing email notifications to the background 5. Asynchronous order data processing Configuration in Stores > Settings > Configuration > Advanced > Developer > Grid Settings > Asynchronous indexing There can be times when intensive sales on a storefront occur when Commerce is performing intensive order processing. You can configure Commerce to distinguish these two traffic patterns on the database level to avoid conflicts between read and write operations in the corresponding tables. You can store and index order data asynchronously. Orders are placed in temporary storage and moved in bulk to the Order Management grid without any collisions. See more information: Enable scheduled grid updates and reindexing 6. Client side optimization settings Configuration in Stores -> Configuration -> Advanced -> Developer When you activate the Enable JavaScript Bundling option, you allow Commerce to merge all JS resources into one or a set of bundles that are loaded in storefront pages. Bundling JS results in fewer requests to the server, which improves page performance. It also helps the browser cache JS resources on the first call and reuse them for all further browsing. This option also brings lazy evaluation, as all JS is loaded as text. It initiates analysis and evaluation of code only after specific actions are triggered on the page. However, this setting is not recommended for stores where the first page load time is extremely critical, because all JS content will be loaded on the first call. Settings GroupSettingValueGrid SettingsAsynchronous indexingEnableCSS SettingsMinify CSS FilesYesJavaScript SettingsMinify JavaScript FilesYesJavaScript SettingsEnable JavaScript BundlingYesTemplate SettingsMinify HTMLYes 7. Bundling tips We recommend that you use third-party tools for minification and bundling (like r.js). Commerce built-in mechanisms are not optimal and are shipped as fallback alternatives. Activating the HTTP2 protocol can be a good alternative to using JS bundling. The protocol provides pretty much the same benefits. We do not recommend using deprecated settings like merging JS and CSS files, as they were designed only for synchronously-loaded JS in the HEAD section of the page. Using this technique can cause bundling and require JS logic to work incorrectly. 8. Database maintenance schedule We recommend performing periodic database backups for your Staging and Production instances. Due to the I/O intensive nature of backup operations, you may encounter slower backups and potential issues. Running database processes for multiple environments at the same time may potentially run slower due to contention for available resources. For better performance, schedule your backups to run in succession, one at a time, at off-peak times. This method avoids I/O contention and reduces time to complete, especially for smaller instances, larger databases, and so on. For example, we recommend scheduling a backup of your Production database followed up by the Staging database when your stores encounter lower visits. Wrap Up By following these best practices, you can streamline your store management processes, improve customer experiences, and ultimately drive the success of your Magento 2 store. Continuous monitoring, optimization, and adaptation to emerging trends are crucial for maintaining a competitive edge in the ever-evolving e-commerce landscape. Related Posts: How to Fix Elastic Search Error After Updating To Magento 2.4.5-p1 Magento 2 Customer Attributes: A Guide for Store Owners Add Magento 2 GTM (Google Tag Manager) In 3 Easy Steps Mark Mac Share Table of Contents Toggle 1. Cron Jobs2. Indexers3. Caches4. Asynchronous email notifications5. Asynchronous order data processing6. Client side optimization settings7. Bundling tips8. Database maintenance scheduleWrap Up