The Linux Virtual Server [offsite]
(LVS) enables TCP/IP and UDP/IP connections to be load balanced
This mechanism of connection control is
often referred to as Layer 4 Switching
as information available at layer 3 of the ISO seven layer protocol
stack is used to make load balancing decisions. That is IP address and
port information is used.
The host that LVS runs on is refered to as the Linux-Director.
And the service that connections are recieved for is refered to
as the virtual service, as it is a service that may be provided
by many physical servers. The Linux Director essentially acts
as a specialised router that forwards packets from end-users to
real-servers - hosts running the applications that actually process
the requests.
When packets are received for a virtual service by the linux-director, the
scheduling algorithm decides which which real-server to send the packet to.
Once this decision is made subsequent packets to for the same connection
will be sent to the same real server. Thus the integrity of the connection
is maintained. Optionally, a service can be marked as persistent. When
this is done all subsequent connections from a given end-user will be
forwarded to the same real-server until a timeout elapses. This is useful
for applications such as FTP where end-users should consistently be
directed to the same real-server to ensure integrity of data connections.
On the Linux Director a virtual service is defined by either an IP Address,
port and protocol, or a Firewall-Mark.
The Linux Virtual Server has three different ways of forwarding packets:
Network Address Translation (NAT), IP-IP encapsulation or tunnelling and
Direct Routing.
In order for LVS to forward all packets for the same connection to
the same real server a small ammount of state is maintained
for each connection. In a nuthsell, the source and destination
ip address and port of the connection, and the real-server that
is being used. If persistance is in use then the information
to allow an end-user to reconnect to the same real-server is
kept in a similar fashion.
If two linux-directors are being used in an active-standby set-up,
such as the any of the High Availability and Load Balancing
topologies, then this connection
infromation needs to be synchronised, so existing connections
can continue if the active linux-director fails and the standby
becomes active. This is done by an in-kernel synchronisation
daemon that is part of LVS. The daemon on the active
linux-director periodically sends out
the neccessary connection information for the active connections
using multicast UDP. A corresponding daemon on the standby linux director
uses this information to seed the local connection table.
Real servers are the ultimate destination of a connection made to
a virtual-service. They run the applications that handle requests
from end-users.
A virtual service's real-servers and are defined by an IP
address, a port and optionally a weight if supported by the scheduling
algorithm that is in effect.
In general, the port
of the real-servers must be the same as that of the virtual service.
If firewall-mark virtual services are used then the port that an incoming
connection is received on will be the port that the connection is forward
to on the real-server, that is the port specification for the
real-erver is not used.
The health of the real-servers may be monitored
using ldirectord.
The version of LVS used by Ultra Monkey 3 depends
on the kernel in use. The 2.4.27-8 kernel for Debian Sarge and
the 2.4.21-27.0.2.EL kernel for
Red Hat Enterprise Linux 3 have been tested
and work with the configurations described.
Copyright © 2000-2005,
HormsLinux-Director
Virtual Services
Scheduling Algorithm
The virtual service is assigned a scheduling algorithm to use to allocate
incoming connections to the real-servers. There are many different
sheduling algorithms available, and new ones are added from time to time.
For an up to date list, and more detailed description, please
see the ipvsadm(8) man page.
Weighted version of Least-Connection.
Packet Forwarding
Connection Synchronisation
Real Servers
Version
Last Updated: Sat Mar 4 16:33:58 2006 +0900
Debian is a registered trademark of Software in the Public Interest, Inc.
Red Hat, the Red Hat Shadowman logo and Fedora are
registered trademarks of Red Hat, Inc.
Red Hat may also be refered to as RedHat on this site.
Linux is a registered trademark of Linus Torvalds.
All other trademarks are the property of their respective owners.