How a Five‑Tier Cache Boosts E‑Commerce Product Retrieval Speed
This article details a multi‑level caching architecture—spanning CDN, Nginx, Redis, JVM cache, and MySQL—that dramatically speeds up product information access in e‑commerce systems while enhancing reliability and scalability.
0 Introduction
In e‑commerce systems, fast retrieval of product information is crucial for user experience. This article explains a multi‑level cache architecture designed to improve performance and reliability.
1 Overall Architecture
The cache system uses a five‑tier strategy from the front‑end to the back‑end:
CDN cache
Nginx cache cluster
Redis cache
JVM local cache
MySQL persistent storage
2 Detailed Walk‑through
1. User Request Entry
Requests first hit the CDN, which serves static assets and reduces load on origin servers.
User -> CDN -> Front‑end Static Resources2. Load Balancing
After CDN, traffic passes through LVS and HAProxy for high‑performance, high‑availability load balancing. CDN -> LVS (Linux Virtual Server) + HA Proxy LVS provides high‑performance load distribution.
HA Proxy adds fine‑grained traffic control and health checks.
3. Nginx Edge (JavaEdge)
JavaEdge is an Nginx cluster that performs initial request handling and forwarding, including IP rate‑limiting and URL parsing.
LVS + HA Proxy -> JavaEdge (Nginx forwarding layer)IP throttling and forwarding
Business routing based on URL
4. Nginx Business Layer
Requests are routed to specific business Nginx instances such as product‑page or checkout Nginx.
JavaEdge -> Single‑product Nginx / Checkout Nginx5. Lua Scripts & Redis Cache
Lua scripts inside Nginx interact with Redis to fetch cached data directly.
Nginx Business Layer -> Lua -> Redis6. JVM Cache
If Redis misses, the request falls back to a JVM‑level local cache for faster access.
Redis (miss) -> JVM Cache7. MySQL Persistence
When all caches miss, the system queries MySQL and then updates the upper caches.
JVM Cache (miss) -> MySQL3 Cache Levels
The five layers are:
Level 1: CDN or browser cache
Level 2: Nginx cache
Level 3: Redis cache
Level 4: JVM local cache
Level 5: MySQL as the ultimate data source
4 Special Notes
Nginx local cache stores hot data to speed up access.
Redis master‑slave sync ensures high availability.
JVM‑to‑Redis updates keep data consistent across layers.
5 Conclusion
The five‑tier cache architecture leverages CDN, Nginx, Redis, JVM cache and MySQL to deliver rapid product information retrieval, improve system performance, reliability and scalability. In practice, one must also handle cache consistency, expiration policies and hot‑data management.
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.
JavaEdge
First‑line development experience at multiple leading tech firms; now a software architect at a Shanghai state‑owned enterprise and founder of Programming Yanxuan. Nearly 300k followers online; expertise in distributed system design, AIGC application development, and quantitative finance investing.
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.
