Академический Документы
Профессиональный Документы
Культура Документы
ABSTRACT
LVS to load balance Internet services, and how this can be made
highly available using tools such as such as heartbeat and keep alived.
It will also cover more advanced topics which have been the subject of
distribute load.
INTRODUCTION
fully transparent to end users, and the users interact with the cluster
appropriately.
in the Linux Kernel. This allows TCP and UDP sessions to to be load
scale Internet services beyond a single host. HTTP and HTTPS traffic
for the World Wide Web is probably the most common use. Though it
can also be used for more or less any service, from email to the
X Windows System.
Applications
media service.
Goals
ability. The LVS cluster system is also known as load balancing server
cluster.
The backup LVS router monitors the active LVS router and takes over
SYSTEM ARCHITECTURE
so that it is easy for servers to keep the same content and provide
techniques, it selects servers from the server pool, maintains the state
performed inside the kernel, so that the handling overhead of the load
balancer is low. Therefore, the load balancer can handle much larger
the system. Since the commodity servers are used as building blocks,
commodity servers.
disable the server in the scheduling table of the load balancer, so that
the load balancer will not schedule new connections to the failed one
Now, the load balancer may become a single failure point of the
need setup a backup of the load balancer. Two heartbeat daemons run
on the primary and the backup, they heartbeat the health message
When the heartbeat daemon on the backup cannot hear the health
message from the primary in the specified time, it will use ARP
its failure, there are two methods. One is that the primary becomes to
the backup of the functioning load balancer; the other is that the
daemon receives the health message from the primary and releases the
virtual IP address, and the primary will take over the virtual IP
cause the established connection in the state table lost in the current
again.
we patch the Linux kernel (2.0 and 2.2) to support three IP load
a set of servers that actually perform the work. In general, real servers
are idential, they run the same service and they have the same set of
contents. The contents are either replicated on each server’s local disk,
clients. This feature can be used to build a virtual server, i.e. parallel
a single IP address.
for virtual service) arrives at the load balancer. The load balancer
examines the packet’s destination address and port number, if they are
matched for a virtual service according to the virtual server rule table,
the connection is added into the hash table which records connections.
Then, the destination address and the port of the packet are rewritten
connection, the connection can be found in the hash table and the
response packets come back, the load balancer rewrites the source
address and port of the packets to those of the virtual service. When a
This technique can be used to build a virtual server that the load
balancer tunnels the request packets to the different servers, and the
servers process the requests and return the results to the clients
directly, thus the service can still appear as a virtual service on a single
IP address.
illustrated in Figure 4. The load balancer and the real servers must
shared by real servers and the load balancer. All real servers have their
loopback alias interface configured with the virtual IP address, and the
supports TCP/IP protocol, and only one IP address is needed for the
load balancer and private IP addresses can be used for real servers.
TCP packets is 536 Bytes and the average delay of rewriting a packet
packets are often short and response packets usually carry large
because the load balancer just directs requests to the servers and the
when the proxy servers receive requests, they can access the Internet
This feature has been tested with servers running Linux. Since the IP
systems.
follow separate network routes to the clients. This can greatly increase
IMPLEMENTATION ISSUES
It looks up the “VS Rules” hash table for new connections, and checks
uses setsockopt function to modify the virtual server rules inside the
kernel, and read the virtual server rules through /proc file system.
balancer of 256 Mbytes free memory can have two million concurrent
their applications, and the client <protocol, address, port>is used as hash
key so that hash collision is very low. Slow timer is ticked every
right real servers, and outgoing ICMP packets from virtual services
will be altered and sent out correctly. This is important for error and
MTU discovery.
be used for different kinds of server clusters, and they can also be used
LVS/TUN.
ALTERNATIVE APPROACHES
end is the server, and there may be a proxy in the middle. Based on
this scenario, we can see that there are many ways to dispatch requests
applet running at the client side. The applet makes requests to the
that server. The applet tries other servers when it finds the chosen
scalable web server using the Round-Robin DNS approach. The RRDNS
robin manner so that the different clients will access the different
servers in the cluster for the ideal situation and load is distributed
among the servers. However, due to the caching nature of clients and
among the servers, thus it is not easy for a server to handle its peak
bottleneck, and with high values the dynamic load imbalance will get
even worse. Even the TTL value is set with zero, the scheduling
server) may pull lots of pages from the site, and others may just surf a
node fails, the clients who maps the name to the IP address will find
the server is down, and the problem still exists even if they press
HTTP requests to different web servers in the cluster, then get the
results, and finally return them to the clients. However, this approach
between the client and the load balancer, the other is between the load
balancer and the server, the delay is high. The overhead of dealing
Parallel SP-2 system. The TCP router changes the destination address
of the request packets and forwards the chosen server, that server is
modified to put the TCP router address instead of its own address as
the source address in the reply packets. The advantage of the modified
approach is that the TCP router avoids rewriting of the reply packets,
a network and they are all configured with the same router address on
The pulse daemon runs on both the active and passive LVS
public interface of the active router to make sure the active LVS router
is properly functioning. On the active LVS router, pulse starts the lvs
router.
configure and maintain the IPVS (IP Virtual Server) routing table in
the kernel and starts a nanny process for each configured virtual server
on each real server. Each nanny process checks the state of one
configured service on one real server, and tells the lvs daemon if the
detected, the lvs daemon instructs ipvsadm to remove that real server
If the backup LVS router does not receive a response from the
of the backup LVS router, sends a command to the active LVS router
via both the public and private network interfaces to shut down the lvs
daemon on the active LVS router, and starts the lvs daemon on the
However, the user is actually accessing real servers behind the LVS
data among real servers, you have have two basic options:
The first option is preferred for servers that do not allow large
of two tiers: LVS routers and real servers. The LVS-router tier
consists of one active LVS router and one backup LVS router. The
network. Each LVS router has two network interfaces: one connected
the real servers on the private network. In this figure, the active LVS
turn provide services as requested. The real servers pass all public
traffic through the active LVS router. From the perspective of clients
Two-TierLVS Topology
more virtual servers. Note that a VIP address migrates from one LVS
separate device per service. For example, HTTP traffic can be handled
capacity or load.
pool.
example, the active LVS router routes the requests from the public
network (Internet) to the second tier — real servers. Each real server
then accesses a shared data source of a Red Hat cluster in the third tier
Three-TierLVS Topology
FORWARDING PACKETS
are received from end users and the destination port and IP
expected source.
replies directly back to the end user. Thus, the linux director
a different networks.
CONCLUSION
used to give the cluster high availability. There are a number of other
LVS itself is a very powerful tool and has many features that
were not within the scope of this presentation. These include; firewall
various tuning parameters. Beyond that there is much scope for further
REFERENCE
1. http://www.linuxvirtualserver.org/docs/scheduling.html
2. http://en.wikipedia.org/wiki/Linux_Virtual_Server
3. ww.ultramonkey.org/papers/lvs_tutorial/html
4. www.redhat.com/docs/manuals/Virtual_Server/index.htm