Operations 5 min read

Mastering Million-Request Concurrency: LVS + Nginx + Keepalived Architecture

This article explains a proven high‑concurrency solution that combines Linux Virtual Server (LVS), Nginx, and Keepalived to achieve million‑level request handling, load balancing, and high availability for large‑scale web services.

Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Mastering Million-Request Concurrency: LVS + Nginx + Keepalived Architecture

Million‑level concurrency architecture is a common challenge for large‑scale websites and high‑traffic systems. This article explains a proven solution that combines LVS, Nginx, and Keepalived to achieve high concurrency, high availability, and load balancing.

Overall Architecture

The architecture consists of an LVS cluster as the front‑end entry (four‑layer load balancer), an Nginx cluster as the middle layer (seven‑layer processing and reverse proxy), multiple backend Web/App servers, and Keepalived to ensure HA for both LVS and Nginx layers.

LVS

LVS (Linux Virtual Server) is a kernel‑level four‑layer load‑balancing solution that distributes external requests efficiently to backend server clusters. Its kernel‑space forwarding, extreme performance, and stability make it the preferred traffic‑distribution component for large‑scale internet services.

An LVS cluster includes a Master (Director) and a Backup. The Master receives all VIP requests and forwards them to the Nginx cluster using DR mode. The Backup stays on standby and, when the Master fails, Keepalived promotes the Backup to Master and transfers the VIP, ensuring seamless service continuity.

Nginx

Nginx receives the requests forwarded by LVS and performs seven‑layer processing, such as HTTP request parsing, URL rewriting, SSL termination, session persistence, and static resource handling.

<code>worker_processes auto;

events {
    worker_connections 10240;
}

use epoll;

http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    gzip on;
    gzip_types text/plain application/json javascript text/css;
    upstream backend {
        server 192.168.10.101:8080 max_fails=2 fail_timeout=10s;
        server 192.168.10.102:8080 max_fails=2 fail_timeout=10s;
        keepalive 32;
    }
    server {
        listen 80;
        server_name localhost;
        location / {
            proxy_pass http://backend;
        }
        location /health {
            return 200 'ok';
            add_header Content-Type text/plain;
        }
    }
}
</code>

Keepalived

Keepalived provides high‑availability (HA) for the LVS service. It monitors the LVS Director servers and promotes the Backup to Master when a failure occurs, ensuring the virtual IP (VIP) remains continuously available. Combined with Nginx, it also guarantees automatic VIP failover for the web layer.

High AvailabilityLoad Balancinghigh concurrencyNginxLVSKeepalived
Mike Chen's Internet Architecture
Written by

Mike Chen's Internet Architecture

Over ten years of BAT architecture experience, shared generously!

0 followers
Reader feedback

How this landed with the community

login 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.