From Single Server to Cloud Native: How Taobao Scaled to Millions of Users
This article traces Taobao’s backend architecture evolution from a single‑server setup to a cloud‑native, micro‑service ecosystem, detailing each scaling stage—separating Tomcat and database, adding caches, load balancers, read/write splitting, sharding, NoSQL, ESB, containers, and finally public‑cloud deployment—while highlighting the associated technologies and design principles.
Overview
This article uses Taobao as an example to illustrate the evolution of server‑side architecture from a hundred concurrent users to tens of millions, listing the technologies encountered at each stage and summarizing design principles.
Basic Concepts
Before discussing architecture, the article defines key concepts:
Distributed : modules deployed on different servers, e.g., Tomcat and database on separate machines.
High availability : when some nodes fail, others take over.
Cluster : a group of servers providing a unified service, with automatic failover.
Load balancing : distributing requests evenly across nodes.
Forward and reverse proxy : forward proxy for internal systems accessing external networks; reverse proxy for external requests entering the system.
Architecture Evolution
1. Single‑machine architecture
Initially Tomcat and the database run on the same server; as traffic grows, competition for resources becomes a bottleneck.
2. Separate Tomcat and database
Deploy Tomcat and the database on separate servers, improving performance, but database read/write becomes the bottleneck.
3. Introduce local and distributed cache
Add local cache in Tomcat/JVM and a distributed cache (e.g., Memcached, Redis) to store hot product data, reducing database load.
4. Reverse proxy for load balancing
Deploy multiple Tomcat instances behind Nginx (or HAProxy) to distribute traffic; session sharing and file‑upload issues arise; the database becomes the new bottleneck.
5. Database read/write separation
Use a master‑write database and multiple read replicas (e.g., via Mycat) to offload reads.
6. Business‑level sharding
Split large tables into smaller ones based on hash or time, enabling horizontal scaling; this introduces operational complexity.
7. LVS/F5 for multi‑Nginx load balancing
Use LVS or hardware F5 to balance traffic among several Nginx layers; keep high availability with keepalived.
8. DNS round‑robin across data centers
Configure DNS to return multiple IPs, directing users to different data‑center entry points.
9. Introduce NoSQL and search engines
Adopt HDFS, HBase, Redis, Elasticsearch, Kylin, Druid, etc., for large‑scale storage, key‑value access, full‑text search, and multidimensional analysis.
10. Split monolithic application into smaller services
Divide code by business domain, use Zookeeper for shared configuration.
11. Extract common functions as micro‑services
Isolate user management, order, payment, authentication into independent services, using Dubbo or Spring Cloud for governance.
12. Enterprise Service Bus (ESB)
Use ESB to unify protocol conversion and reduce coupling, resembling SOA architecture.
13. Containerization
Package services into Docker images and orchestrate with Kubernetes for dynamic scaling.
14. Cloud platform
Deploy to public cloud (IaaS, PaaS, SaaS) to leverage elastic resources and reduce operational cost.
Design Summary
The article lists principles such as N+1 redundancy, rollback capability, feature toggles, monitoring, multi‑active data centers, mature technology adoption, resource isolation, horizontal scalability, buying non‑core components, commercial hardware, rapid iteration, and stateless design.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
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.
