Operations 4 min read

Inside Alibaba’s City‑Level Active‑Active Architecture: A Complete Guide

The article explains Alibaba’s city‑level active‑active architecture, where two independent data centers in the same city simultaneously serve traffic, automatically fail over on outage, and are organized into traffic, application, and data layers with detailed design patterns.

Mike Chen Rui
Mike Chen Rui
Mike Chen Rui
Inside Alibaba’s City‑Level Active‑Active Architecture: A Complete Guide

City Active‑Active Overview

City active‑active deploys two independent data centers within the same city, each running a full set of services that are simultaneously active and receive traffic. When either data center fails, traffic is automatically switched to the other, providing uninterrupted service.

Architecture Layers

Traffic Layer

The traffic entry layer uses a global load balancer to distribute user requests to data center A or B based on IP geolocation or round‑robin algorithms. An application gateway at each data‑center entrance parses a route key (e.g., user_id) and determines the target cell. If a request lands in the wrong data center—such as an odd user_id that should be handled by A but arrives at B due to DNS drift—the gateway performs an internal cross‑data‑center redirect to the correct location.

Alibaba City Active‑Active Architecture
Alibaba City Active‑Active Architecture

Application Layer

Services are designed to be stateless. Typical practices include:

Stateless Web/API services

Centralized session storage

Unified task‑scheduling center

Data Layer

The data layer is the key to a successful active‑active deployment. Common patterns are:

Master‑slave replication with automatic failover (a basic one‑master‑one‑slave setup, not true active‑active)

Dual‑master architecture where both centers can write, requiring conflict resolution and strong consistency mechanisms

Sharding by business domain or user segment, placing different business lines or user groups in separate centers to reduce cross‑center write conflicts

阿里同城双活架构详解(看这篇就够了)-mikechen
阿里同城双活架构详解(看这篇就够了)-mikechen

Typical request flow:

User request
│
┌────────┴────────┐
│                │
│   IDC‑A        IDC‑B
│   (Active)      (Active)
│                │
│   Application Cluster
│   Application Cluster
│                │
│   Redis Cluster   Redis Cluster
│   MySQL Cluster   MySQL Cluster
│                │
│   │            │
│   │            │
│   └────────────┘

By separating responsibilities across the traffic, application, and data layers and applying the appropriate data‑layer pattern, continuous availability and seamless failover are achieved for services running in the same city.

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.

AlibabaDistributed ArchitectureHigh AvailabilityApplication LayerData LayerActive-ActiveTraffic Layer
Mike Chen Rui
Written by

Mike Chen Rui

Over 10 years as a senior tech expert at top-tier companies, seasoned interview officer, currently at leading firms like Alibaba.

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.