Design, Advantages, and Architecture of Static/Dynamic Separation
The article explains the concept of static/dynamic separation, compares deployment methods such as Nginx and CDN, discusses domain strategies, outlines its benefits and drawbacks, and presents an architecture suitable for high‑traffic static content delivery.
Static/dynamic separation (also called "dynamic-static separation") isolates website static resources (HTML, JavaScript, CSS, images, etc.) from backend applications, allowing static files to be served faster and reducing load on the backend.
1. Deploy static resources on Nginx – static files are placed on an Nginx server while the backend runs on an application server; all static requests are routed to Nginx.
2. Deploy static resources on a CDN – a better solution is to store all static assets (JS, CSS, images, HTML) on a CDN, which automatically directs user requests to the nearest node, improving latency and simplifying front‑end maintenance.
3. Backend API provides data – the backend (commonly Java/Tomcat or Node) exposes JSON APIs that the front‑end consumes.
4. Front‑end and back‑end domain handling – using the same domain avoids cross‑origin issues, while different domains require CORS or JSONP handling but allow independent load‑balancing strategies.
Advantages
API‑centric backend enables service reuse across modules and platforms.
Front‑end and back‑end can develop in parallel, reducing integration time.
Static servers (CDN/Nginx) handle static traffic, lowering backend load and speeding up content delivery.
Disadvantages
Search engine optimization may suffer because crawlers see less content when the page relies heavily on JavaScript.
Increased development effort: front‑end must understand API status codes and business logic.
When business scales rapidly, the added complexity of separation can impact delivery speed.
Static/Dynamic Separation Architecture
The architecture uses an Object Storage Service (OSS) as the source for massive files (images, videos, download packages, app updates). OSS feeds a CDN, which serves static files to users from the nearest edge node.
Key benefits of this architecture
Web server load is reduced because all static traffic goes through the CDN.
Massive storage capacity without the need to upgrade storage infrastructure.
Applicable scenarios
High static file access volume causing server load and I/O bottlenecks.
Insufficient server storage for large numbers of static files.
Static files accessed by users distributed across many regions.
Mobile update packages requiring high‑speed, concurrent downloads.
Mike Chen's Internet Architecture
Over ten years of BAT architecture experience, shared generously!
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.