This article describes specific steps you can take to optimize a Magento site.
Magento includes several configuration options that you can use to help improve your site's speed and responsiveness. The procedures below show how to configure these options so they are optimized for high performance.
By default on shared servers, the Magento cron job runs every 15 minutes. However, this frequent interval is unnecessary and can lead to performance issues that not only affect your account, but other accounts as well. For step-by-step instructions about how to configure Magento's cron jobs for optimal performance and help avoid potential slowdowns, please see this article.
Magento's default log setting can cause databases to grow very large, affecting site performance. By optimizing Magento's log settings and cleaning the database log tables, you can significantly reduce database sizes and improve site performance. For step-by-step instructions about how to do this, please see this article.
Magento includes several built-in caches, and you should make sure that they are all enabled for your store. To do this, follow these steps:
Under Cache Storage Management, confirm that the status for all of the caches is set to ENABLED.
Custom modules are stored in Magento's app/code/local directory. If there are no files in this directory (or if the local directory does not even exist), you can instruct Magento to ignore the directory, which can improve performance.
To do this, open the app/etc/local.xml file in your preferred text editor, and then set the <disable_local_modules> tag to true as shown:
<disable_local_modules>true</disable_local_modules>
To re-enable local modules, set the <disable_local_modules> tag to false.
Magento's .htaccess file contains some Apache optimizations that are disabled by default. By enabling these optimizations, you can help decrease page load times for your store.
The Apache mod_deflate module enables you to compress output. This both saves bandwidth and ensures faster page download times. To enable output compression for Magento, follow these steps:
<IfModule mod_deflate.c> ############################################ ## enable apache served files compression ## http://developer.yahoo.com/performance/rules.html#gzip # Insert filter on all content SetOutputFilter DEFLATE # Insert filter on selected content types only AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript # Netscape 4.x has some problems… BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </IfModule>
The Apache mod_expires module enables you to instruct web browsers how long to cache certain types of content. This both saves bandwidth and ensures faster page download times. To enable browser caching directives for Magento, follow these steps:
<IfModule mod_expires.c> ############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires ExpiresDefault "access plus 1 year" ExpiresByType text/html A0 ExpiresByType text/plain A0 </IfModule>
For Magento 1.9, uncomment the lines in the mod_expires text block as follows:
<IfModule mod_expires.c> ############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires ExpiresActive On ExpiresDefault "access plus 1 week" </IfModule>
You can reduce your store's page load times by minimizing the number of HTTP requests required to load a page. One way to do this is to merge Magento's JavaScript and CSS files into single files.
To merge and minify JavaScript and CSS files on Magento 2, follow these steps:
To merge JavaScript and CSS files on Magento 1.9, follow these steps:
By default, Magento uses its own Entity Attribute Value (EAV) model to store customer and product information. Although this method is flexible, it may result in slower and more complex SQL queries.
Flat catalogs are an alternative to EAV. In flat catalogs, Magento merges product and category data into single tables, as opposed to the multiple tables for EAV. Doing this often improves database performance and response time.
To enable flat catalogs for your store on Magento 2, follow these steps:
To enable flat catalogs for your store on Magento 1.9, follow these steps:
When a web browser requests a page or resource that does not exist on the server, a 404 Not Found error occurs. Magento replaces the server's default 404 Not Found page with its own custom page. This means that every time a 404 Not Found error occurs, the Magento application runs, increasing CPU load.
To help reduce load on the server, you should make sure that your Magento store does not contain links to nonexistent resources.
You can disable the output from any unused modules. To do this, follow these steps:
Click
This procedure only disables the output a module generates—it does not disable the module itself. To disable a module completely:
bin/magento module:disable Magento_Authorizenet
For more information about how to use the Magento 2 CLI, please see this article.
For Magento 1.9, open the app/etc/modules/module_name.xml file, where module_name represents the name of the module you want to disable. In the module_name.xml file, set the <active> tag to false as shown:
<active>true</active>
To re-enable the module, set the <active> tag to true.
Magento includes several options to help developers debug and troubleshoot problems. These options can consume system resources and negatively affect performance, so they are disabled by default.
You should only enable these options if you need to troubleshoot a specific problem. To verify that these options are disabled for your store, follow these steps:
To view the official Magento documentation, please visit http://www.magentocommerce.com/knowledge-base.