Phần 4: Content delivery & tăng tốc website Part 4: Content delivery & website speed · Bài 1/4 Lesson 1/4

CDN & cache hit/miss CDN & cache hit/miss

Hiểu HIT tại PoP vs MISS về origin. Cache static assets; không cache HTML có session. Understand PoP HIT vs MISS to origin. Cache static assets; do not cache HTML with sessions.

CDN & cache hit/miss
Minh họa từ Cloudflare Reference Architecture (developers.cloudflare.com) Illustration from Cloudflare Reference Architecture (developers.cloudflare.com)

Các bước thực hiện Step-by-step

  1. Caching → Configuration: xem Cache Rules mặc định. Caching → Configuration: review default Cache Rules.
  2. Mở Caching → Cache Rules: cache static (/assets/*, *.css, *.js). Caching → Cache Rules: cache static paths (/assets/*, *.css, *.js).
  3. Bypass cache cho /admin, /checkout, cookie session. Bypass cache for /admin, /checkout, session cookies.
  4. Kiểm tra response header `CF-Cache-Status`: HIT vs MISS. Check response header `CF-Cache-Status`: HIT vs MISS.

Giải thích chi tiết Detailed explanation

CDN cache giảm latency và chi phí origin — nhưng cache nhầm HTML có session sẽ lộ data user. CDN cache cuts latency and origin cost — but caching session HTML leaks user data.

Lưu ý (best practices) Note (best practices)

Bật Tiered Cache (có trên mọi gói) — cache gần user hơn, giảm request về origin và tăng cache hit ratio. Enable Tiered Cache (included on every plan) — content is cached closer to users, reducing origin requests and improving cache hit ratios.

Nguồn: Source: Content Delivery Network (CDN) Reference Architecture Content Delivery Network (CDN) Reference Architecture

Ví dụ triển khai (Cloudflare Resources) Deployment examples (Cloudflare Resources)

Tutorial, solution guide và reference từ developers.cloudflare.com/resources ↗ — gợi ý theo chủ đề bài học. Tutorials, solution guides, and reference docs from developers.cloudflare.com/resources ↗ — matched to this lesson topic.

Sơ đồ kiến trúc Reference architecture diagram Chung / đa lĩnh vực Cross-cutting

Designing a distributed web performance architecture

/reference-architecture/diagrams/content-delivery/distributed-web-performance-architecture

Mở tutorial / guide ↗ Open tutorial / guide ↗

Duyệt toàn bộ catalog → Browse full catalog →

Tài liệu Cloudflare Developers Cloudflare Developer docs

Sơ đồ kiến trúc (Cloudflare Docs) Architecture diagrams (Cloudflare Docs)

Figure 1: Data flow overview

Designing a distributed web performance architecture Designing a distributed web performance architecture

Pattern L7: data flow, cache tiers, deployment models — giảm latency và cải thiện Core Web Vitals. A prescriptive pattern for building a Cloudflare-based L7 performance architecture that reduces latency, raises cache efficiency, and improves Core Web Vitals.

Thuật ngữ: Concepts: CDN · Cache · Core Web Vitals · Smart Shield · Argo

Sơ đồ chính thức ↗ Official diagram ↗ · Content delivery Content Delivery

Sản phẩm liên quan Related products

Đọc thêm trong hub → Read more in the hub →