0% found this document useful (0 votes)
15 views

Programming Algorithms of Load Balancing With HA-Proxy in HTTP Services

This document discusses load balancing algorithms for HTTP services using the HA-Proxy tool. It aims to analyze HA-Proxy's load balancing scheduling algorithms and provide guidance on which algorithm and infrastructure to use for different implementations. The information is based on a literature review, field study, and implementing the various algorithms on equipment to analyze performance and load distribution. Incorporating this technology improves availability, business continuity, and allows systems administrators to choose the best algorithm based on advantages and disadvantages for their needs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Programming Algorithms of Load Balancing With HA-Proxy in HTTP Services

This document discusses load balancing algorithms for HTTP services using the HA-Proxy tool. It aims to analyze HA-Proxy's load balancing scheduling algorithms and provide guidance on which algorithm and infrastructure to use for different implementations. The information is based on a literature review, field study, and implementing the various algorithms on equipment to analyze performance and load distribution. Incorporating this technology improves availability, business continuity, and allows systems administrators to choose the best algorithm based on advantages and disadvantages for their needs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

JOURNAL OF SCIENCE AND RESEARCH: REVISTA CIENCIA E INVESTIGACIÓN, E-ISSN: 2528-8083, VOL. 3, CITT2017, PP.

100-105 100

Programming Algorithms of load balancing with HA-Proxy in HTTP


services
Programación de algoritmos de balanceo de carga con HA-Proxy de servicios HTTP

José Teodoro Mejı́a Viteri1,* , Marı́a Isabel Gonzáles Valero1,† , and Ángel Rafael España León1,‡ .
1 Universidad Técnica de Babahoyo, Ecuador.

[email protected];mery [email protected];arel [email protected]


Received: August 15, 2017 — Accepted: September 15, 2017
How to cite: Mejı́a Viteri, J., Gonzáles Valero, M. I., & España León, Ángel R. (2018). Programming Algorithms of load balancing with
HA-Proxy in HTTP services. Journal of Science and Research: Revista Ciencia e Investigación, 3(CITT2017), 100-105. https://doi.org/10.
26910/issn.2528-8083vol3issCITT2017.2018pp100-105
Abstract—The access to the public and private services through the web gains daily protagonism, and sometimes they must support
amounts of requests that a team can not process, so there are solutions that use algorithms that allow to distribute the load of
requests of a web application in several equipment; the objective of this work is to perform an analysis of load balancing scheduling
algorithms through the HA-Proxy tool, and deliver an instrument that identifies the load distribution algorithm to be used and
the technological infrastructure, to largely cover implementation. The information used for this work is based on a bibliographic
analysis, field study and implementation of the different load balancing algorithms in equipment, where the distribution and its
performance will be analyzed. The incorporation of this technology to the management of services on the web, mproves availability,
helps business continuity and through the different forms of distribution of the requests of the algorithms that can be implemented
in HA-Proxy to provide those responsible for information technology systems with a view of their advantages and disadvantages.
Keywords—Technology Communications, Availability of Information, Data Security.

Resumen—El acceso a los servicios públicos y privados a través de la web gana protagonismo diario, y a veces debe soportar
cantidades de solicitudes que un equipo no puede procesar, por lo que existen soluciones que utilizan algoritmos que permiten para
distribuir la carga de las peticiones de una web aplicación en varios equipos; el objetivo de este trabajo es realizar un análisis de
algoritmos de programación a través de la herramienta HA-Proxy de balanceo de carga y entregar un instrumento que identifica
el algoritmo de distribución de carga a utilizar y la infraestructura tecnológica, para cubrir en gran parte puesta en práctica. La
información utilizada para este trabajo se basa en un análisis bibliográfico, estudio de campo y aplicación de los algoritmos en el
equipo, donde se analizará la distribución y el rendimiento de equilibrio de carga diferentes. La incorporación de esta tecnologı́a a
la gestión de servicios en la web, mproves la disponibilidad, continuidad del negocio ayuda a y a través de las diferentes formas de
distribución de las solicitudes de los algoritmos que pueden ser implementadas en HA-Proxy para proporcionarlos responsable de
sistemas informáticos con el fin de sus ventajas y desventajas.
Palabras Clave—Tecnologı́a de comunicaciones, La disponibilidad de información, Seguridad de datos.

I NTRODUCTION save information, and allows the accessible from a computer


or mobile.
T he internet in the beginning allowed to visualize contents
of static pages and the client acceded to review informa-
tion on some subject of interes. but as time went by companies
All this is possible through the web server ”which is the
heart of the web and defines how web clients request objects
to a server and as servers transfer them to clients”, (Kurose
began to provide email services, chat, besides giving a com-
and Ross, 2009), that is to say it is in charge of managing
munication option also incorporated messages that served as
the requests of services that are requested to the pages that
marketing to encourage users to buy some type of article or
provide services of the companies, thanks to this it increases
service, but today the internet has become an accessible and
the profitability but also the requests of the clients and often
mobile network, because the voice, data and video traveling
causes the page is not available or the delivery of information
through different networks is now performed through this
to customers is slow, causing discomfort and sometimes lost
large network called cloud so described by its complexity of
customers and money for poor service satisfaction,thanks to
interconnections,implemented at the global level that allows to
this it increases the profitability but also the requests of the
carry out formalities in governmental institutions,bank, and at
clients often causes the page is not available or the delivery
the same time buy and sell through the websites of companies.
of information to customers is slow causing discomfort and
Nowadays, public institutions and private companies offer
sometimes lost customers and money for poor service satis-
trading processes in their websites and archieved with other
faction this is why availability plays an important role, so that
services such as: data bases, streaming, e-mail, VoIP and ap-
the services of the company are active for the client with a
plications created with programming languages that access and
minimum response time.
* Magı́ster en Informática Empresarial
This availability that is the characteristic of a system to
† Magı́ster en Informática Empresarial remain active before contingency, this implies higher costs
‡ Magı́ster en Informática Empresarial because the implementation of high availability is directly
JOURNAL OF SCIENCE AND RESEARCH: REVISTA CIENCIA E INVESTIGACIÓN, E-ISSN: 2528-8083, VOL. 3, CITT2017, PP. 100-105 101

proportional to the cost in technological infrastructure, it is for GET and POST methods
this reason that the research aims to implement and analyze The GET method asks for a specified resource representation.
the results of the techniques that allow to manage the load that For security, it should not be used by applications that cause
a web server receives. effects, since it transmits information through the URL, adding
And the following topics are considered successively: Web parameters to it. The POST method sends data to the server
Servers, protocol HTTP (Hypertext, Transfer; Protocol), High that can be part of a database, messages to a group of users,
availability, the different algorithms that exist and the tools for etc. Unlike the GET method, it can send any amount of data
their implementation and analyze the response time results in without limit and it does not send information as part of
the requests to the web server. the URL. The data is included in the body of the request
(Rı́os Pérez et al., 2017).

W EB SERVER , HA - PROXY AND LOAD BALANCING High Availability


ALGORITHMS Currently, there are several implementations of high
availability clusters and all of them seek to offer excellent
Web Server
levels of availability and efficiency of the service, always
A Web server is an application that allows you to answer safeguarding the information security and emphasizing load
and respond to requests originating from browsers, providing balancing processes, storage and maintaining the reliability
resources requested through the protocol http or securely of the system through the Redundancy as main technique
through the protocol HTTPS. (Bowen and Coar, 2007).
The hypertext transfer protocol – HTTP is a protocol of the
layer of the TCP/IP (Transmission Control Protocol/Internet Load Balancing Algorithms
Protocol) (Kurose and Ross, 2009). Load Balancing Algorithms are responsible for distributing
All companies use internal processes to manage their in- the load among the available nodes to distribute requests,
formation flows and external business processes in order to decisions that are made based on different methodologies.
interact with their partners, customers and employees in the The methods to be studied are:
value chain. Both processes can be managed with Web services
to reduce costs and boost business agility (Cáceres Alvarez Round Robin
et al., 2011). It is one of the best known, in this case the balancer receives
Intern Web Services: belong to the companies hat uses them requests from clients regardless servers characteristics or the
and can serve to connect different companies departments, load that can support the first request that sends the first node
such as Sales, Human Resources, Finance and Production. configured with the web server and then to the second one
For example, a financial application can call in real time until distributes one request to each available server.
a web service that converts euros into dollars or the Sales
Department can call another to query certain information from Static Round Robin
the customer database (Cáceres Alvarez et al., 2011). It is a variant of Round Robin, but with the additional
characteristic of assign o request percentage to each available
External Web Services: allow companies to exchange
web server for balancing load.
services over the Internet. A company interested in a
particular service can go to a directory of Web services like
Least Connection
UDDI (Universal Description, Discovery and Integration)
This algorithm appears to solve the count of requests for
to look for it. An example of these public records is
each one of the web servers to control the amount of open
www.xmethods.net where you can find hundreds of free web
connections in the web servers.
services (Cáceres Alvarez et al., 2011).
HA-Proxy
Apache It’s a free solution, very quickly and reliable that offers
Apache is a free web server developed by Apache Server high availability and allows commutation by error and load
Project. Its main objective is the creation of reliable, efficient balancing and proxy for TCP and HTTP based on applications.
and easily extendable web server with free open source When HAProxy is running in HTTP mode, both the request
(Márquez Dı́az et al., 2011). and the response are completely analyzed and indexed, so it
is possible to construct matching criteria in almost any of the
What is HTTP? contents.
HTTP (Hypertext Transfer Protocol) works at the application
level in the OSI model for hypermedia distributed and Apache-jmeter
cooperative information systems. Its main characteristic The Apache JMeter application is open source software, a
is that it allows negotiating the type of data and its 100 % pure Java application designed to load test functional
representation, leaving the possibility to build systems around behavior and measure performance. It was originally designed
it independently of the transferred data (de la Mora, 1997). for testing Web Applications but has since expanded to test
performance on both static and dynamic resources.
JOURNAL OF SCIENCE AND RESEARCH: REVISTA CIENCIA E INVESTIGACIÓN, E-ISSN: 2528-8083, VOL. 3, CITT2017, PP. 100-105 102

M ETHODOLOGY
Bibliographic and Documentary Analysis
Collection of information was carried out and are represented
in a unified systematic way to facilitate it compression, through
analysis and synthesis, through indexing, annotation.

Programming Algorithms Implementation


This research is developed by the virtualization of 3 compu-
ters, one is used as load balancer, and two web servers to
receive requests.

Figure 1. Test Equipment Layout.


Source: Prepared by the authors.

In each computer was realized the installation of Centos 7


virtual Operative System, through the Virtual Box 5.1.26 tool
with the following characteristics:
Table 1. Characteristics of the computers used for the implementation
Processor Intel
R Core i7 CPU 2.60GHZ
RAM 1 GB
Swap 1.5 GB
Hard Drive 15 GB
Source: Prepared by the authors.

The installation of the Apache 2.2.4.6 server in two virtual


computers that receive the requests from the load balancer
called Server1, Server2.
The install of an HA-Proxy tool to manage requests from
clients, allows to implement algorithms in the load balancer.
JOURNAL OF SCIENCE AND RESEARCH: REVISTA CIENCIA E INVESTIGACIÓN, E-ISSN: 2528-8083, VOL. 3, CITT2017, PP. 100-105 103

Figure 4. Thread Group Configuration.


Source: Prepared by the authors.

In the following figure, you can see the IP configuration of


our balancer, it receives the users request and use the POST
method because it is used in the development of dynamic web
sites to send data to the server and can be processed, this
Figure 2. Ha-proxy configuration file 1. Load Balancer Configura- means to make an update action or data entry, because, the
tion. GET method only performs information requests. The number
Source: Prepared by the authors. of threads for the test is 10000.

The install of Apache-jmeter 3.2 tool allows to make


requests to our load balancer y this will distribute according
to the implemented algorithm.
The Apache-jmeter app make the configuration of the th-
reads that is the number of clients that make requests to the
load balancer and are processed by server 1, server 2. The main
purpose is watching the programming algorithm development
with HA-Proxy tool, also, with the top command we locate the
Figure 5. Configuring assertions.
number of the process assigned to the HA-Proxy tool and see
how it behaves the processor and memory consumption, these Source: Prepared by the authors.
are the essential parameters to see the load that is receiving,
Finally, the insertion is performed to show the results of the
in this case, with HA-Proxy server.
“Response Assertion”, Response Assertion”, in order to verify
that all requests to the load balancer have been successfully
performed, for this we add the string pattern ”200”, which
means that the web page has been served correctly in the
following graph shows the configuration options.

R ESULTS
Implementation of Programming Algorithm

Figure 3. HTTP in Apache-Jmeter Requests Configuration.


Source: Prepared by the authors.

Figure 6. Implementation of Round Robin Programming Algorithm


Number of users configuration from http requests to the load con HA-Proxy.
balancer. Source: Prepared by the authors.
JOURNAL OF SCIENCE AND RESEARCH: REVISTA CIENCIA E INVESTIGACIÓN, E-ISSN: 2528-8083, VOL. 3, CITT2017, PP. 100-105 104

In the figure below, you can see the implementation in In the graphic below we can see in the backed webserver of
the backed web server section of the round robin as the the static round-robin scheduling as a programming algorithm
programming algorithm requests. in the requests and has a 50 % of load for each web server,
Processor Consumption and Round Robin Memory. because these are not with the same characteristics and can
configure with different loading in each server in percentage
number of load.
Static Round-Robin Processor and Memory Consumption.

Figure 7. Top command in the Load Balancer.


Source: Prepared by the authors.

In this picture, we see the amount of percentage using of Figure 11. Top Command in the Load Balancer.
the processor is 58.1 % and 2.2 & Memory. Source: Prepared by the authors.

In the following graphic, we can see the amount of processor


using percentage (60.7 %) and memory (3.0 %).

Figure 8. Result of Apache-JMeter with Round Robin Algorithm


Implementation.
Source: Prepared by the authors.
Figure 12. Result of Apache-JMeter with Static Round-Robin Pro-
As seen in the table, the average time taken by a request gramming Algorithm Scheduling As we can see in the table below,
is 33 seconds, the maximum time invested in a request is 262 the average time taken by the request is 169 seconds, which take times
seconds and the minimum is 3 seconds, and the number of to process 10000 request to the server, the maximum time invested
requests processed per second w ere 987.7 per second, the by a request is 1471 seconds and the minimum is 3 seconds, the
amount of data processed is 371.33 Kilobits per second. number of processed requests per second were 889.8 per second, the
amount of processed data are 334.56 Kb/s.
Source: Prepared by the authors.

Figure 9. Result of a Number of Petitions per server by an HA-Proxy Figure 13. HA-Proxy tool Number of requests per server.
Tool.
Source: Prepared by the authors.
Source: Prepared by the authors.
In the graphic below we can see that 10000 requests are
The following picture shows that 10000 requests are
distributed equally in both servers.
distributed equally in both servers.

Static Round-Robin Algorithm Scheduling Least Connection Algorithm

Figure 10. Static Round Robin with Ha-Proxy Configuration. Figure 14. Least Connection Configuration with HA-Proxy.
Source: Prepared by the authors. Source: Prepared by the authors.
JOURNAL OF SCIENCE AND RESEARCH: REVISTA CIENCIA E INVESTIGACIÓN, E-ISSN: 2528-8083, VOL. 3, CITT2017, PP. 100-105 105

In the picture below, we see the backed webserver section round robin algorithm average time in seconds that can take
setting of the least connection memory as programming algo- a processed request is 33 seconds, the minimum is 3 seconds,
rithm in the requests. the amount of requests per second is 987,7 and the amount of
Least Connection processor and memory consumption. data is 371 kb per second. This shows that the Round Robin
programming algorithm requests with HA Proxy efficiency is
superior to the others evaluated, but it also must be pointed
that in the other two algorithms it is possible to regularize the
load, it means to put a higher percentage of requests trough
each one of the servers that can distribute the HA-Proxy load.

C ONCLUSIONS
Figure 15. Top Command in the Load Balancer.
Source: Prepared by the authors. The implementation of higher availability allows to business
to improve its services, using a higher availability architecture
Below, we can see the amount of percentage of processor design that depends on the networking hardware, because
using (54.5 %) and memory (1.3 %). the studied algorithms can realize variants to load balance in
percentages when the servers’ characteristics are different.
The evaluated efficiency of the programming algorithms in
the proposed infrastructure was favorable to Round-Robin, but
it is possible to indicate that in the implementation and tests,
servers with the same characteristics were used. However,
Figure 16. Results of Apache-JMeter with Least Connection Algo-
rithm Setting. the Static Round Robin algorithms, Least Connection, can be
Source: Prepared by the authors.
used when the infrastructure includes equipment with different
characteristics that allow to establish percentages of requests
As we can see in the table below, the average time taken by that can receive each server.
the request is 49 seconds, which take times to process 10000 This research work can be used as a methodology to
request to the server, the maximum time invested by a request evaluate the performance of high-availability programming
is 1726 seconds and the minimum is 3 seconds, the number algorithms, in different scenarios that may vary according to
of processed requests per second were 693.9 per second, the the case study, where the traffic analysis can perform with
amount of processed data are 260.88 Kb/s. different technology architecture.

B IBLIOGRAPHIC R EFERENCES
Bowen, R. and Coar, K. (2007). Apache Cookbook: Solutions
and Examples for Apache Administration. .O’Reilly Media,
Inc.”.
Cáceres Alvarez, L. M., Bernabé, P., and Alejandro, M. (2011).
Modelo de programación ası́ncrona para web transacciona-
Figure 17. HA-Proxy tool Number of requests per server.
les en un ambiente distribuido. Ingeniare. Revista chilena
Source: Prepared by the authors.
de ingenierı́a, 19(1):26–39.
de la Mora, S. (1997). Hablando HTTP.
10000 request are not equally distributed in both servers
Kurose, J. F. and Ross, K. W. (2009). Computer networking:
although they have the same characteristics, the server 1
a top-down approach, volume 4. Addison Wesley Boston,
received 5237 and server 2 received 4763 (see next graphic).
USA.
Márquez Dı́az, J., Sampedro, L., and Vargas, F. (2011). Insta-
D ISCUSSION
lación y configuración de apache, un servidor web. Revista
Table 2. Programming Algorithm Results Cientı́fica Ingenierı́a y Desarrollo, 12(12):10–23.
Rı́os Pérez, F. E., Polanco Carrillo, F., and Moreno Vega,
Rend. Cons. Cons.
Algorit. Med. Máx Mı́n Rend. V. (2017). Servidor web empotrado en un fpga para
Kb/s CPU mem.
Round-
33 262 3
987,7
371.33 58.1 % 2.2 %
configurar un controlador maestro del sistema inteligente de
Robin /sec tráfico cubano. Revista Cubana de Ciencias Informáticas,
Static
Round 169 1471 3
889,8
334.56 60.7 % 3.0 % 11(2):16–28.
/sec
Robin
Least
693.9
Connec 49 1726 3 260.88 54.5 % 1.3 %
/sec
tion
Source: Prepared by the authors.

The Table.2 shows the data summary of the obtained results


with each programming algorithm and it its observed that the

You might also like