Introduction to Linux Virtual Server (LVS): Architecture and Features
This article provides a comprehensive overview of Linux Virtual Server (LVS), covering its basic concepts, three‑tier architecture, load‑balancing techniques, scheduling algorithms, high availability, reliability, and suitable deployment environments for building high‑performance, scalable server clusters.
1. Introduction to LVS
LVS (Linux Virtual Server) is an open‑source load‑balancing solution initiated by Dr. Zhang Wensong. It enables high‑performance, highly available server clusters by combining Linux with LVS’s load‑balancing technology, offering reliability, scalability, and ease of operation at low cost.
2. LVS Architecture
The LVS cluster consists of three logical layers: the Load Balancer layer (Director Server), the Server Array layer (real servers), and the Shared Storage layer. Users interact with a virtual IP address, while the Director distributes requests to real servers based on configured scheduling algorithms.
Load Balancer Layer
The Director Server runs the LVS module and acts like a router, maintaining routing tables that map the virtual IP to real servers. It also runs Ldirectord to monitor real server health, removing unhealthy servers from the routing table.
Server Array Layer
Real servers provide the actual services (web, mail, FTP, DNS, video, etc.) and are connected via high‑speed LAN or WAN. A Director can also serve as a real server.
Shared Storage Layer
This layer offers shared storage and data consistency for all real servers, typically implemented with disk arrays and shared file systems such as NFS, GFS, or OCFS2.
3. Features of LVS Clusters
3.1 IP Load Balancing and Scheduling Algorithms
LVS uses the IPVS kernel module to implement IP‑level load balancing. It supports NAT, TUN, and Direct Routing (DR) modes, each with different packet‑forwarding mechanisms.
VS‑NAT
Network Address Translation rewrites the destination address to a selected real server and rewrites the source address on the response, causing all traffic to pass through the Director, which can become a bottleneck under heavy load.
VS‑TUN
IP tunneling forwards client requests to a real server via a tunnel; the real server replies directly to the client, reducing the Director’s load and increasing throughput.
VS‑DR
Direct Routing changes the MAC address to forward packets to the real server, which replies directly to the client, offering the highest performance but requiring the Director and real servers to share a network segment.
The article also lists common scheduling algorithms such as Round Robin, Weighted Round Robin, Least Connections, Weighted Least Connections, Locality‑Based Least Connections, Destination Hashing, and Source Hashing.
3.2 High Availability
LVS operates at the kernel level, delivering high throughput (up to 1 Gbps on 100 Mbps NICs with VS/TUN or VS/DR, and near 10 Gbps on 1 Gbps NICs) and ensuring that failure of a single node does not affect the overall service.
3.3 High Reliability
Many large‑scale web sites use LVS, demonstrating its stability; clusters can run for long periods without restart.
3.4 Suitable Environments
The Director (load balancer) supports Linux and FreeBSD and works with most TCP/UDP protocols (HTTP, HTTPS, FTP, SMTP, DNS, NTP, etc.). Real servers can run any TCP/IP‑compatible OS, including Linux, BSD, Solaris, macOS, and Windows.
3.5 Open‑Source License
LVS is released under the GPL, allowing users to access and modify the source code under the same license.
IT Architects Alliance
Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.