How can Magento be made to run faster

Are you happy with your current hosting provider ?

This article provides detailed instructions for optimizing a Magento website. In order to run Magento efficiently, your server should have at least 16 GB of RAM, preferably 32 GB. To run Magento efficiently, you’ll need either a high-end VPS or a dedicated hosting plan. In order to run a full Magento website, you will need a dedicated hosting account.

Optimizing Magento

Magento comes with a slew of performance-enhancing settings that you can tweak to your heart’s content.
The following instructions will walk you through the steps necessary to set these options up for maximum performance.

Magento 2 and 1.9 can both use the settings described here.
Some of these options may not be available in earlier versions of Magento.

If your site’s performance is still not at the level you desire, there are additional options:

Drop-in Apache replacements are used in Turbo Boost, Turbo Max Web hosting, and managed VPS with Turbo Boost accounts, allowing pages to load up to five times faster than with regular web hosting.

Memcached can be used to speed up page load times on managed VPS, managed Dedicated servers, Turbo Boost, and Turbo Max Web Hosting accounts.

Cron job

Magento’s cron job runs every 15 minutes by default on managed servers.
On the other hand, this frequent interval can lead to performance issues that affect not only your account but those of other users as well.
Detailed instructions on configuring Magento’s cron jobs for maximum performance and avoidance of slowdowns can be found here.

Logging

Due to Magento’s default log setting, databases can quickly become unmanageably large, resulting in decreased site responsiveness.
It is possible to significantly reduce database sizes and improve site performance by optimizing Magento’s log settings and cleaning the database log table.

Caching

Your Magento store should be using all of the built-in caches, and you should do so.
Take these steps to accomplish this:

Once you’ve logged in to Magento as an administrator, proceed as follows:

  1. Cache management can be found under SYSTEM in the left sidebar of Magento 2.

2. Cache management can be found in the top menu bar of Magento 1.9.

Make sure that all of the caches are enabled in Cache Storage Management.

Make sure that you have checked the box next to the cache type you want to enable, then select Enable from the drop-down menu.

Local modules

Only Magento 1.9 can benefit from this optimization.

Magento’s app/code/local directory houses custom modules.
To speed things up, you can tell Magento to ignore this directory if there are no files in it or if the local directory does not even exist.

Using a text editor of your choice, open the app/etc/local.xml file, and then change the disable local modules> tag to true as shown:

<disable_local_modules>true</disable_local_modules>

Set the <disable local modules> tag to false to re-enable local modules.

Apache optimizations

Some Apache optimizations are disabled by default in Magento’s .htaccess file.
You can help your store’s page load times by enabling these optimizations.

Compression

Compressing output is made possible by the Apache mod deflates module.
As a result, less data is transferred and the page loads more quickly.
Magento output compression can be enabled by performing the following steps:

  1. Open the .htaccess file in a text editor of your choice.

2. Deflate mod deflate by uncommenting the lines in the text block.

<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

3. Save the.htaccess file with your changes.

The changes are immediate.

Browser caching

Allows you to control how long certain types of content are cached by modifying the Apache mod_expires module

As a result, less data is transferred and the page loads more quickly.

Follow these steps to enable Magento’s browser caching directives:

1. Open the.htaccess file in a text editor of your choice, and then do the following:

a) The lines in the mod expires text block should be uncommented as follows:

<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>

b) Uncomment the following lines in the mod expires text block to make it work with Magento 1.9:

<IfModule mod_expires.c>

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

   ExpiresActive On
   ExpiresDefault "access plus 1 week"

</IfModule>

2. Save the.htaccess file with your changes.

The changes are immediate.

JavaScript and CSS files

By reducing the number of HTTP requests needed to load a page, you can speed up your store’s page load times.

Magento’s JavaScript and CSS files can be combined into a single file to accomplish this.

Magento 2

Following these steps will help you merge and compress Magento 2’s JavaScript and CSS files.

1. Use your administrator account to log in to Magento.

2. Configuration can be found under Settings in the left-hand sidebar by clicking STORES and then clicking Configuration.

3. ADVANCED should be selected first, followed by DEVELOPER.

4. In the list box that appears, select Yes under the Merge JavaScript Files heading.

5. Select the Yes option in the Minify JavaScript Files drop-down menu.

6. To merge CSS files, click CSS Settings and then Yes in the list box.

7. Select Yes in the list box for minifying CSS files.

8. Click the Save Config button.

When JavaScript and CSS files are combined and minified, it can be difficult to debug them.

Disable the options in steps 4–7 if you’re working on development or troubleshooting.

A new set of separate JavaScript and CSS files will be generated and re-assembled by Magento.

Magento 1.9

In Magento 1.9, these are the steps to merge the JavaScript and CSS files:

1. Use your administrator account to log in to Magento.

2. Click System on the top menu bar, then Configuration.

3. Under ADVANCED, click Developer in the Configuration pane on the left side.

4. In the list box that appears, select Yes under the Merge JavaScript Files heading.

5. To merge CSS files, click CSS Settings and then Yes in the list box.

6. Click the Save Config button.

JavaScript and CSS can be difficult to debug when they are combined.

Disable the options in steps 4 and 5 if you’re working on development or troubleshooting.

A new set of separate JavaScript and CSS files will be generated and re-assembled by Magento.

Flat catalogs

Customers and products are stored in Magento’s Entity Attribute Value (EAV) model by default.

The flexibility of this method may lead to slower and more complex SQL queries.

As an alternative to EAV, flat catalogues can be used instead.

As opposed to EAV’s multiple tables, Magento merges product and category data into one table in flat catalogues.

Database performance and response time can be improved by performing this operation frequently.

Magento 2

Magento 2 users can enable flat catalogues by following these steps:

1. Use your administrator account to log in to Magento.

2. Click SYSTEM in the left sidebar, then Index Management.

3. Make sure the Product Flat Data checkbox is selected.

4. Select the Flat Data checkbox in the Category drop-down menu.

5. Select Update on Save in the Actions list box, and then click Submit.

6. Configuration can be found on the left sidebar by clicking STORES.

7. Afterwards, select CATALOG and then select Catalog.

8. To access the Storefront page, click here.

9. Yes should be selected in the box labelled “Use flat catalogue category list.”

10 Select Yes from the Use Flat Catalog Product drop-down menu.

11. Click the Save Config button.

Cache-clearing Magento

12. Make sure you’ve clicked SYSTEM on the left sidebar, then Cache Management.

13. Flush Cache Storage by clicking the Flush Cache Storage button.

14. Click the button labelled “Flush Magento Cache” to perform the requested action.

Magento 1.9

Follow these steps to make your Magento 1.9 store’s flat catalogues functional:

1. Use your administrator account to log in to Magento.

2. Click System in the top menu bar, then Index Management.

3. Select the Product Flat Data option.

4. Select the Category Flat Data checkbox.

5. Select Reindex Data from the Actions list and then click Submit.

6. Click System on the top menu bar, then Configuration.

7. Click Catalog in the Configuration pane on the left.

8. Select Frontend from the drop-down menu.

9. Yes should be selected in the box labelled “Use flat catalogue category list.”

10. Select Yes from the Use Flat Catalog Product drop-down menu.

11. Click the Save Config button.

12. Cache-clearing Magento

a. Click System, then Cache Management from the top menu.

b. Click Flush Cache Storage in the Cache Storage Management section.

404 errors

A 404 Not Found error occurs when a web browser requests a page or resource that does not exist on the server.

404 Not Found is replaced by Magento’s custom 404 Not Found page.

Because the Magento application is running every time a 404 Not Found error occurs, this increases CPU load.

Make sure that your Magento store does not have links to nonexistent resources in order to reduce server load.

Module output

The output of any unused modules can be turned off.

Take these steps to accomplish this:

Once you’ve logged in to Magento as an administrator, proceed as follows:

1. Click STORES and then Configuration in the left sidebar to access Magento 2’s store settings.

2. Then select ADVANCED from the drop-down menu.

3. On the top menu bar of Magento 1.9, click System, and then click Configuration in order to make changes.

4. Inside this Configuration tab on the left side, scroll down a bit, and then under ADVANCED, click Advanced.

5. Locate the module output you want to disable, and then select Disable from the Disable Modules Output section.

6. Click the Save Config button.

Developer debugging and logging

In order to assist developers in debugging and resolving issues, Magento provides a number of tools.

Disabling these options will consume system resources and negatively impact performance, which is why they are turned off by default.

These options should only be enabled if you need to investigate a specific issue.

Follow these steps to make sure that these options aren’t available in your store:

Use your administrator account to log in to Magento.

1. Click System on the top menu bar, then Configuration.

2. Under ADVANCED, click Developer in the Configuration pane on the left side.

3. Click the Debug button.

4. The Profiler list box should be set to No.

5. Select Log Settings.

6. The Enabled list box should be set to No.

7. Click the Save Config button.

Hostnats introduces you to Optimized Magento Hosting and Magento Migration Service at a cost-effective pricing scheme.