Processing... Please wait...

Product was successfully added to your shopping cart.

Magento performance optimization - 7 steps to a faster website (2024)

Server response time optimization Server response time optimization

I have been optimizing Magento 2 sites for quite a while. During the process, there are a few things I've learned. I'd like to share them with you.

I’ve learned that:

  • Time to First Byte is an important metric

  • Magento Site speed is key to maintaining your conversions

  • Not all Optimization techniques require programming skills

While it is true that some speed optimization tweaks require extensive knowledge of the Magento platform, it is also proven that there are others that require no programming at all; yet they are effective.

This post brings together the field-proven performance tuning techniques. You are free to skip steps that require extensive programming. Do your best with the easy ones and you will speed up your Magento store.

This guide mainly targets Magento 2. However, if you are still running Magento 1.x, you can apply some of the tweaks found in this post. Or migrate to M2.

7 Performance Fixes:

  1. Magento optimized hosting.

  2. Time to first byte audit.

  3. MySQL tuning.

  4. Full Page Cache.

  5. Varnish.

  6. PHP8.

  7. CDN.

Before we dive into how these seven components can help make Magento faster, we first need to look into why Magento website performance is so important.


One of the big things to look for when conducting Magento optimization is site speed. Essentially, site speed measures how fast a site loads and how fast it can travel between web pages.

Since customers are always on the go, it’s really important for eCommerce businesses to make sure customers can get to their products quickly.

Let’s dive a little more into why Magento site speed is important:

Why is Magento Slow?

There are a variety of reasons as to why your Magento website is running slowly. However, it mostly happens due to wrong configuration and wrong choice of hosting provider.

You see, Magento is not like it’s other competitors. You are not restricted on SKU numbers or anything like that, but with great power comes great responsibility. You do need the right hosting and if you are not tech savvy, you need a trustworthy magento programmer to help you along the way.

Another common problem is that there are too many product attributes with too many choices. Product attributes allude to the characteristics of a product. Meaning, if you have a customizable product on your Magento site, your customers would be able to choose the quantity, size, or even the color of the product.

Adding color product attributes with just a few choices (black, white, green) would not hurt. However, creating 10 product attributes with hundreds of choices would really slow down a Magento website. If you take a look here, you can see the resolution product attribute with many choices, as well as other multiple choices attributes. Without proper tuning, these factors slow down the Magento website significantly.

If that’s not the problem, then what may be the problem is that your website has too much code to load. Generally speaking, one of the many problems my clients face when dealing with a slow website is that the JavaScript, HTML, and CSS all take a lot of time to load because each consists of so much code.

I have found what works best with my clients is that I minimize the HTML and JavaScript. As for the CSS, I take the code and I place it at the bottom of the website so that the code will load fast. By the time the CSS starts loading, the web page will already show and the CSS will load without complications.

Here is a comprehensive guide on how to make Magento websites fast. Keep these steps in mind when you build your eCommerce store as well as when you run it.

1. Magento Optimized Hosting

You can speed up Magento with the right service provider. But, you need to do the research and get a good hosting.

A common mistake among my clients is that they tend to go for the cheapest hosting offered to them. When they tell me this, I always say the same thing: Cheap hosting is not good and good hosting is not cheap. Hosting is the foundation of your eCommerce store, so be sure to lay a good foundation. Some hosting providers offer Magento optimized solutions. Be sure to do the research, talk to customer support and find the best hosting for you and your store.

Shared or dedicated?

Shared hosting is a type of hosting that allows many websites to be on one server. This is an ideal route if your website has a small inventory and is just starting out. On the other hand, dedicated hosting allows one website to take over its own server. If you have a lot of inventory and large amounts of traffic, your website would have fewer chances of crashing if it were hosted on its own server.

If your website needs to withstand large amounts of traffic, that also probably means that your server can reach maximum capacity on a shared server. This means that your Magento website would be better off on a dedicated server.

With these facts in mind, it is really up to you to decide whether to go with shared or dedicated hosting. However, if you are a small store that wants to jump into dedicated hosting, but is intimidated by the price, I can assure you that, in my experience, I have seen many stores running pretty fast on shared servers.

Look for the data center that is closest to your customers because you want to eliminate network issues. I would consider choosing the right host as the most important advice. Build your eCommerce business on solid ground.

2. Reduce Time to First Byte (TTFB)

TTFB is the measure of how quick your website responds to browser requests. The TTFB is generally made up of three separate components:

  • The time needed to send the HTTP request

  • The time needed for the server to process the request

  • The time needed for the server to send back the first byte of the response to the client

If you were to notice the white screen on your computer before the homepage loads, that is a clear sign of a website's TTFB.

Blank Screen Blank Screen

In simple words, it is the main speed parameter that tells you how fast your Magento store is. In the Magento platform, it is also one of the most important indicators of Magento site speed.

To inspect your site’s platform behind the scenes, there is a Magento built-in tool, called Profiler, to tweak Magento performance. However, there are other ways to reduce your Magento site’s TTFB.

An ideal TTFB should be under 1s. You can use online tools like Pingdom to see what is your TTFB is. If your TTFB is over 1s - that is a sign that you should start researching for ways to reduce it.

Three Reasons for a Slow TTFB Include:

  • Web server issues

  • The main server has reached its full capacity

  • Slow commands due to database optimization

Reducing your TTFB requires a few simple tools. In fact, here is a great tutorial on how to reduce your TTFB.

3. Optimize MySQL database

One important thing that can also affect site's performance is a MySQL database. Sometimes, website databases give slow commands because they need to be optimized. MySQL is a database that is comprised of your website data. Your data can comprise of anything from a simple product listing to a fully comprehensive wishlist.

The first thing to do would be to gather MySQL internal statistics with mysqltuner script. This program tells you what is wrong with your database server and what needs fixing. It requires Perl interpreter to be installed on the server.

Look for MySQL Table Cache Hit Rate (table_cache). If it says 0% - you are not using a database table cache at all. MySQL Table Cache configuration lets DB keep tables in memory thus speeding up access to its data. Tweak the table_cache parameter in my.cnf file to have table cache hit rate as close to 100% as possible.

Another setting to check is Table Open Cache (table_open_cache). That parameter greatly affects performance by making the same table available for different sessions.

I would advise you to get an expert in MySQL optimization to check your database server. If you are on shared hosting, your host team most likely takes care of your database tuning for you. If you run dedicated server either spend time learning MySQL configuration or get your DB configured by experts.

4. Enable Cache

Enabling your site’s cache can improve your overall performance by allowing the site to load faster and keeping track of the pages your visitors access.

4.1 Internal Magento Cache

Enabling you internal Magento cache is easy. Simply go to the admin panel and do the following:

4.2 APC or Memcached

After you have enabled your internal Magento cache, the next step is to enable the Magento cache in the app/etc/env.php file. If you need help doing this, you can always consult a certified Magento developer.

Check with your hosting to see if it supports APC or Memcached, as these programs cache sessions and other important data.

5. Install and configure Varnish

Varnish is a little program that caches parts of your webpage. I highly recommend that you install the latest version, as shown on the screen, and run it. Magento 2.0 supports Varnish but if you need to run Varnish on Magento 1.x, you would need a free extension by Nexcess - Turpentine. It’s worth noting that Turpentine is used by many stores and it follows Varnish Cache’s Best Practices.

Download Varnish Download Varnish

If you have any questions about installing an extension on your Magento site, feel free to ask here.

You should also make sure your host supports Varnish. If you run a dedicated server you might need to install and configure Varnish. If you are not sure, check with your provider to make sure that your hosting supports Varnish.

Before going live, be sure to test your varnish implementation! Check if your cart block at the top has changed and check if it contains the products you added.

Giving your store a good test drive after Varnish implementation is important because Varnish has been known to break eCommerce stores.

6. PHP 8

You can improve Magento 2 performance by upgrading to PHP 8. The latest Adobe Commerce 2.4.6 supports it.

PHP 8 has several optimizations that could improve loading speed.

Perform an upgrade yourself or hire an expert. Never forget to backup data and files.

7. Content Delivery Network (CDN)

Content Delivery Network Content Delivery Network

CDN is a group of regional servers that can transfer static content. In terms of content delivery, you can say that they’re the backbone of the internet. With that, I strongly recommend that you sign up for CDN services. It is cheap and it does serve the static content (ex. images, CSS/JS files, video, etc) faster than your host would. Companies with great CDN plans include MaxCDN, Cloudflare.

If anything else, ask your host if they offer CDN services.

Why Should I Care?

Magento site speed is one of the most important keys to having a successful website and, ultimately, a successful business.

Remember that 47% of customers leave a site for loading too slow. That means that for every 100 people that go to your website, a slow Magento website will cause 47 of them to leave in 3 seconds or less.

Can you imagine spending so much time creating your website, gaining traction on social media & trying to rank on search engines, only to lose nearly half of the customers that enter your site in three seconds just because your Magento website did not load fast enough?

Your business can lose a lot of conversions by simply having a site that is slower than your competitors. On the other hand, your business can convert that much more people if your website is much faster than your competitors.

If the following reason was not enough, Magento site speed affects your Google Rankings. In fact, in July of 2018, Google started penalizing websites that had slower loading times than other pages on the SERP (Search Engine Results Page). So if you have noticed a change in your once strong rankings, but did not change your digital marketing strategy, that is a sign that it is time to check your page speed.

Aside from all of that, Magento performance optimization makes checkout less irritating for your customers. In our day and age, nobody wants to wait. This is especially true when buying on the internet. Happy customers generally mean repeat customers, which not only makes you more money but also saves you money because it’s cheaper to keep a current customer in your business cycle than to introduce a new customer into your business cycle.

These seven tips will make your online store fast. It will attract more potential customers.


If you find this post interesting do not hesitate to sign up for our newsletter and join the 1312 people who receive Magento news, tips and tricks regularly.

Thank You!


4 thoughts on “Magento performance optimization - 7 steps to a faster website (2024)”
  • Stella George December 31, 2020 at 8:17 am

    Nyc Article on Magento performance optimization! Thank you for sharing!

  • Database Optimization Techniques August 5, 2020 at 5:14 am

    Your article is very nice & useful.
    Wish to see much more like this. Thanks for sharing your information

  • Luis Paul December 23, 2019 at 8:52 am

    The tips you've mentioned in the blog post are highly recommendable.

    Thanks for the great blog post.

  • Peter Gustafson March 27, 2019 at 9:17 am

    Great article. The need for speed is huge. Thanks for keeping us updated Kon.