Optimize Magento Time To First Byte

When looking at the performance of your site, waterfall charts are one of the first places you should investigate. The first thing that is represented on these charts is that the HTML for the website is the first resource that is downloaded every time.

As a result of being the first resource downloaded every time, this is the logical first place to look to improve the performance of your Magento website. There are a few ways to make sure that the page downloads more quickly, and they all involve making sure that the file size is as small as possible.

GZip Compression

The first way to make the download size smaller and thus, make sure the HTML of the site downloads faster is to turn on GZip compression on the server. This is typically a setting that can be configured on the web server, and will automatically be used when the client’s web browser is able to support it.

Eliminate Unnecessary Content

Many of the pages that you will find online will have HTML that is not used to display the content on the site. Whether this is due to unnecessary nesting of HTML elements or simply hiding content that is not visible. Remove this from the site, and you will be amazed at how much smaller the download size and time will be reduced.

Minify HTML

Once you have done all of the above, consider minifying the HTML content of the site. This involves removing all of the duplicate whitespace from the HTML content of the site. The one thing to remember about HTML minification is to make sure to leave any spaces in place that exist between HTML tags as these may be used for layout on the site. In addition, if you have inline JavaScript in the HTML, you should make sure to either not remove the line breaks in this portion of the code, remove comments that begin with // or replace all comments that start with // with /* code here */ so that you will not inadvertently comment out your JavaScript.

Each of these solutions are fairly simple to implement in Magento, but requires some testing to make sure that nothing is broken in the process.

Related Posts

Apr 6, 2014
2 minutes

Saving Products in Magento Deletes Tier Pricing

Magento’s framework makes many things simple to accomplish when working with the products and categories of your eCommerce website. However, I have found one scenario that doesn’t exactly work as expected.

Tier Pricing in Magento

Magento allows you to setup custom pricing levels based upon the quantity purchased. You set the minimum quantity purchased to enable the lower price when the part is added to the customer’s cart. You could see where losing the tiered pricing for an entire catalog of products would be a big deal for a site.

Apr 14, 2014
One minute

Varnish and Magento Performance Mystery

One of the things that you think you will solve when you implement a Varnish caching server in front of a Magento website is performance problems. However, this is not necessarily the case.

When I set Varnish up to cache content in front of my Magento website, I get what seems to be much improved performance. If I run a few tests in the developer tools of Chrome, it seems that the waterfall chart makes sense and the data is loaded appropriately and in a timely manner with the main HTML being downloaded in about 300ms.

Apr 17, 2014
2 minutes

MySQL Deadlocks with Magento

One of the things that Magento, and specifically the Zend Framework provide developers is the ability to not have to think about database details as it should just handle all that for you. When it becomes obvious that there is a problem somehow with the production database getting some sort of SQL errors, its time for the developers to start caring about the implementation and architecture details of the database.