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