Book Image

Instant Magento Performance Optimization How-to

By : Nayrolles Mathieu (USD), Mathieu Nayrolles
Book Image

Instant Magento Performance Optimization How-to

By: Nayrolles Mathieu (USD), Mathieu Nayrolles

Overview of this book

The optimization of an attractive commercial website is a non-trivial task that demands time and knowledge. Optimization is a critical point for all growing businesses because a misconfiguration could make you lose money, a lot of money. If your server is overloaded, a browser that wants to turn into a buyer will not be able to, and you will lose customers. "Instant Magento Performance Optimization How-To" is a practical, hands-on guide that provides you with a number of clear, step-by-step exercises to help you reach a high performance level for your Magento stores and keep your customers satisfied.This book looks at tweaks and tips used to boost your Magento Performance, and breaks down the confusion that surrounds the subject.You will learn how to compress your pages, styles, and scripts by almost 80%. We will also take a look at controversial optimization settings such as Magento core compilation or enabling all caching systems. You will discover new applications that improve performance. If you wish your e-businesses to grow and want to keep your customers satisfied, you definitely need this book.
Table of Contents (7 chapters)

Removing PayPal's logo (Must know)


The display of images from other websites can slow down your whole web page. Indeed, we have to resolve the distant address and then start a new download process from this distant server.

How to do it...

We definitely appreciate how easily we can make money with Magento through PayPal, but let's have a look at PayPal's logo on our website. PayPal's logo is a 160 x 60 GIF image and its size is only 5.3 KB. Nevertheless, this tiny image comes from the PayPal website and it's amazingly slow to get it displayed on our website.

In order to remove it, go to System | Configuration | Payment Methods | PayPal All-in-One Payment Solutions and then hit the Configure button. In this page, go to Basic Settings - PayPal Payments Advanced | Advanced Settings | Frontend Experience Settings and select No Logo.

Save your configuration in the top-right corner. The following table shows the data for the PayPal logo:

Type

Requests

Load time

Size

With the PayPal logo

37

1.72 seconds

719 KB

Without the PayPal logo

35

1.12 seconds

713.4 KB

More than half a second less on the loading of the home page with this simple setting. Of course, we encourage you to display PayPal's logo on your website; just host it locally.

How it works...

The PayPal logo is hosted on the PayPal website. According to the Pingdom Tools website (http://tools.pingdom.com), the statistics of this image are as follows:

We will not be able to achieve any less than 1.70 seconds on the loading of the home page because all images are loaded in parallel. The reason this image takes so long to be retrieved from PayPal's servers is because our server has to resolve the real address of the image, and SSL is activated for all communications with PayPal, even for images.

There's more...

Downloading images from the distant server can improve your performance if the distant server is specifically designed to achieve this task.

Using a content delivery network (CDN)

A content delivery network, also known as CDN, is a group of servers scattered all over the world inside data centers in order to deliver static content such as images and style files, in an optimized way. Indeed, your users can have a server belonging to the CDN that is closer than your Magento server, and the CDN servers are optimized for delivering static contents.

Let's have a look at our website if we turn on all the options we have previously studied:

  • Set Merge CSS Files to Yes

  • Set Merge JavaScript Files to Yes

  • Set Log Settings Enabled to No

  • Set Compilation Enabled to Yes

  • Set Index up to date to Yes

  • Set PayPal Logo to No

The following table shows you how much we have improved Magento's performances so far:

Type

Requests

Load time

Size

CSS (before)

3

107 milliseconds

100.6 KB

CSS (after)

1

35 milliseconds

110.6 KB

JS (before)

13

742 milliseconds

363.4 KB

JS (after)

1

62 milliseconds

360 KB

Overall (before)

49

2.58 seconds

724.3 KB

Overall (after)

35

1.12 seconds

713.4 KB

With these six very simple settings, we improve our performance by more than one second.

Nevertheless, 1.12 seconds is still high for an e-commerce website. With the following settings, we will go deeper in order to break the 1-second wall. To do that huge task, we will compress the size of our pages by 80 percent, set up and administrate caching systems, and optimize the way PHP, Apache, and MySQL work.

With the previous settings, we have improved the performance of our test subject by almost 1 second with six simple settings. It's time to go under the surface of Magento and the different servers that support it. As previously done, for each new task we will turn off or reverse the previous settings in order to clearly identify what the pros of each one are. However, all settings seen before are still enabled.

As a reminder, the following table shows our test subjects' performances:

Type

Requests

Load time

Size

CSS

1

35 milliseconds

110.6 KB

JS

1

62 milliseconds

360 KB

Overall

35

1.12 seconds

713.4 KB

We will show you how to parameterize your servers in order to get some speed. We advise you to rename the local.xml.sample file inside the /errors/ directory of Magento to local.xml. With this action, you will be able to see errors on your Magento frontend.

We assume that most of the readers are on a Linux-based system. The following is the configuration for this book:

  • 2x Ubuntu Server 12.04.1 (32 bit), 2 GB RAM, and 1 Core at 2.7 GHz

  • MySQL 14.14

  • Apache 2.2.22

  • PHP 5.3.10-1