Operations 15 min read

Master Linux Virtual Server (LVS): Architecture, Modes & Algorithms

This article introduces Linux Virtual Server (LVS), explains its three‑tier architecture, details its main components and three load‑balancing methods (NAT, IP Tunneling, Direct Routing), compares their performance, and reviews the eight scheduling algorithms used for traffic distribution.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux Virtual Server (LVS): Architecture, Modes & Algorithms

1. What is LVS?

LVS (Linux Virtual Server) is a clustering technology that uses IP load‑balancing and content‑based request distribution to create a high‑performance, highly available virtual server composed of multiple real servers. The cluster is transparent to clients and requires no changes to client or server applications.

Design considerations include transparency, scalability, high availability, and ease of management. LVS typically adopts a three‑tier architecture as shown below.

2. Main components of LVS

Load balancer / Director : the front‑end that receives client requests and forwards them to a pool of real servers, presenting a single virtual IP address to clients.

Server pool (Realservers) : the actual servers that handle services such as web, mail, FTP, DNS, etc.

Shared storage : provides a common storage area for the server pool, ensuring consistent content across servers.

3. LVS load‑balancing methods

Virtual Server via Network Address Translation (VS/NAT)

In VS/NAT the director rewrites packets and forwards them to real servers. The director can also act as a real server. This method is simple but the director may become a bottleneck as the number of real servers grows.

Virtual Server via IP Tunneling (VS/TUN)

IP tunneling encapsulates a packet inside another IP packet, allowing the director to forward encapsulated packets to the selected server, which then decapsulates them. The response is sent directly back to the client.

Virtual Server via Direct Routing (VS/DR)

VS/DR rewrites the MAC address of the packet and sends it directly to the chosen server over the same LAN. The director does not modify or encapsulate the IP packet, and the server replies directly to the client.

4. Comparison of the three methods

VS/NAT works with any TCP/IP OS and uses a single IP address on the director, but its scalability is limited; performance measurements on a Pentium 166 show about 60 µs packet rewrite latency and a maximum throughput of 8.93 MB/s.

VS/TUN can handle hundreds of servers because the director only forwards packets; with a 100 Mbps full‑duplex NIC the cluster can exceed 1 Gbps throughput.

VS/DR offers similar scalability without the tunneling overhead, but requires the director and real servers to share a physical network segment and to disable ARP responses on the virtual IP.

5. LVS scheduling algorithms

LVS (IPVS) implements eight scheduling algorithms:

Round‑Robin Scheduling

Weighted Round‑Robin Scheduling

Least‑Connection Scheduling

Weighted Least‑Connection Scheduling

Locality‑Based Least Connections (LBLC)

Locality‑Based Least Connections with Replication (LBLCR)

Destination Hashing Scheduling

Source Hashing Scheduling

Each algorithm balances load based on different criteria such as equal distribution, server weight, current connection count, request locality, or hash of IP addresses.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

network architectureload balancingLinuxScheduling AlgorithmsLVS
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.