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)

Balancing load (Become an expert)


What could be the next major improvement in clustering our environment? Get more and more web servers to take care of the heavy work due to the generation of pages.

How to do it...

Our aim in this recipe is to build an architecture where our customers accede to one unique server, but this server is able to balance requests on other servers depending on their current load.

Each server belonging to the second layer of servers is an exact replica of your Magento server. You can either reinstall your web server and Magento on each one or ask your hosting company to deliver you an exact replica of the old one. The real work is on the front server, the one to which your customers accede. We have to install a piece of software called reverse proxy in order to forward requests from this frontend server to every backend server.

Open a new terminal and enter the following command:

sudo apt-get install pound

Then edit the file named pound.cfg in the /etc/pound/ directory so that it looks like the following code:

ListenHTTP
  Address 10.0.0.1 #FRONT SERVER ADDRESS
  Port 80

  Service
    BackEnd
      Address 10.0.0.2 #MY FIRST BACKEND SERVER
      Port 80
    End
    BackEnd
      Address 10.0.0.3 # MY SECOND BACKEND SERVER
      Port 80
    End
    #REPEAT BACKEND BLOCKS FOR EACH SERVERS
  END
END

Enable the frontend server to start by modifying the value of Startup in /etc/default/pound as follows:

Startup = 1

Then start the frontend server using the following command and it will switch from one server to another, depending on the load:

Sudo /etc/init.d/pound start

How it works...

The idea behind this well-known technique, named load balancing, is to get one server in front of the others and for that server to redirect users to the least loaded servers at that moment. Moreover, you have web servers behind this one; so each of them will be less loaded.