CDN là gì? Hiểu Cloudflare Cache như đang giải thích cho bạn bè What is a CDN? Understanding Cloudflare Cache in plain language What is a CDN? Understanding Cloudflare Cache in plain language
CDN giống mạng kho hàng gần người dùng. Cloudflare Cache giữ bản sao nội dung tĩnh gần bạn — trang mở nhanh hơn, server gốc đỡ “mệt”. Think of a CDN as warehouses near your users. Cloudflare Cache keeps copies of static content close by — pages load faster and origin servers work less. Think of a CDN as warehouses near your users. Cloudflare Cache keeps copies of static content close by — pages load faster and origin servers work less.
Thiết kế kiến trúc hiệu năng web phân tán 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. 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: Concepts: CDN · Cache · Core Web Vitals · Smart Shield · Argo
Sơ đồ chính thức ↗ Official diagram ↗ Official diagram ↗ · Phân phối nội dung Content Delivery Content Delivery
CDN giải quyết vấn đề gì trong đời thực? What problem does a CDN solve in real life? What problem does a CDN solve in real life?
Hãy tưởng tượng bạn bán hàng online ở Việt Nam, nhưng server (máy chủ gốc — origin) đặt ở Mỹ. Mỗi lần khách mở ảnh sản phẩm, dữ liệu phải “bay” nửa vòng Trái Đất. Trang chậm, khách bỏ đi, server gốc phải trả lời mọi request dù ảnh gần như không đổi. Imagine your online store serves customers in Vietnam, but the origin server sits in the US. Every product image travels halfway around the world. Pages feel slow, shoppers leave, and the origin answers every request even when the image barely changes. Imagine your online store serves customers in Vietnam, but the origin server sits in the US. Every product image travels halfway around the world. Pages feel slow, shoppers leave, and the origin answers every request even when the image barely changes.
CDN (Content Delivery Network) là mạng máy chủ phân tán khắp thế giới. Cloudflare đặt bản sao nội dung gần người dùng hơn — gọi là edge. Khi ai đó ở Hà Nội mở trang, họ thường nhận file từ điểm gần mình thay vì lúc nào cũng hỏi server ở Mỹ. A CDN (Content Delivery Network) is a global mesh of servers. Cloudflare keeps copies of content closer to users — at the edge. Someone in Hanoi often gets files from a nearby point of presence instead of always hitting a US origin. A CDN (Content Delivery Network) is a global mesh of servers. Cloudflare keeps copies of content closer to users — at the edge. Someone in Hanoi often gets files from a nearby point of presence instead of always hitting a US origin.
Trên blog.cloudflare.com, các bài về CDN và cache thường nhấn mạnh một ý: tốc độ không chỉ là “cho đẹp” — nó gắn với trải nghiệm, chi phí băng thông origin, và khả năng chịu traffic đột biến khi có chiến dịch hoặc tin nóng. On blog.cloudflare.com, CDN and cache posts often stress one idea: speed is not cosmetic — it ties to experience, origin bandwidth cost, and surviving traffic spikes during campaigns or viral moments. On blog.cloudflare.com, CDN and cache posts often stress one idea: speed is not cosmetic — it ties to experience, origin bandwidth cost, and surviving traffic spikes during campaigns or viral moments.
Tối ưu phân phối ảnh với Image Resizing và R2 Optimizing image delivery with Cloudflare image resizing and R2 Optimizing image delivery with Cloudflare image resizing and R2
Giải pháp tối ưu phân phối ảnh, mở rộng được và hiệu năng cao — Image Resizing kết hợp R2. Learn how to get a scalable, high-performance solution to optimizing image delivery. Learn how to get a scalable, high-performance solution to optimizing image delivery.
Thuật ngữ: Concepts: Concepts: Image Resizing · R2 · Transformations · Cache
Sơ đồ chính thức ↗ Official diagram ↗ Official diagram ↗ · Phân phối nội dung Content Delivery Content Delivery
Cloudflare Cache hoạt động như thế nào (không cần thuật ngữ nặng)? How Cloudflare Cache works (without heavy jargon) How Cloudflare Cache works (without heavy jargon)
Khi bạn bật proxy (đám mây cam) cho website, request của người dùng đi qua mạng Cloudflare trước. Với nội dung phù hợp để cache — ảnh, CSS, JavaScript, một số trang HTML tĩnh — Cloudflare có thể lưu bản sao và trả lại lần sau mà không cần hỏi origin. When you orange-cloud (proxy) a site, user requests hit Cloudflare’s network first. For cacheable content — images, CSS, JavaScript, some static HTML — Cloudflare can store a copy and answer later without asking the origin. When you orange-cloud (proxy) a site, user requests hit Cloudflare’s network first. For cacheable content — images, CSS, JavaScript, some static HTML — Cloudflare can store a copy and answer later without asking the origin.
Bạn có thể hình dung như tủ lạnh văn phòng: lần đầu ai đó mang đồ ăn từ siêu thị (origin) về; lần sau đồng nghiệp lấy từ tủ lạnh (cache) — nhanh hơn và đỡ phải đi siêu thị lại. Cache “hết hạn” hoặc bị xóa khi bạn cập nhật nội dung quan trọng. Picture an office fridge: the first person brings food from the supermarket (origin); coworkers later grab it from the fridge (cache) — faster, fewer supermarket trips. Cache expires or gets purged when you publish important updates. Picture an office fridge: the first person brings food from the supermarket (origin); coworkers later grab it from the fridge (cache) — faster, fewer supermarket trips. Cache expires or gets purged when you publish important updates.
Không phải mọi thứ đều nên bỏ vào tủ lạnh. Trang giỏ hàng, trang tài khoản, API trả dữ liệu cá nhân — nếu cache sai, người A có thể thấy dữ liệu người B. Đó là lý do Cloudflare và tài liệu chính thức luôn phân biệt nội dung tĩnh (an toàn hơn để cache) và nội dung động (cần quy tắc rõ). Not everything belongs in the fridge. Cart pages, account pages, and APIs with personal data — if cached wrongly, user A could see user B’s data. That is why Cloudflare and official docs separate static content (safer to cache) from dynamic content (needs clear rules). Not everything belongs in the fridge. Cart pages, account pages, and APIs with personal data — if cached wrongly, user A could see user B’s data. That is why Cloudflare and official docs separate static content (safer to cache) from dynamic content (needs clear rules).
Ba lợi ích dễ đo được khi dùng CDN đúng cách Three easy-to-feel benefits when you use a CDN well Three easy-to-feel benefits when you use a CDN well
Một: thời gian mở trang giảm vì file nặng được phục vụ gần người dùng. Hai: origin “nhàn” hơn — ít request ảnh/CSS trùng lặp — hữu ích khi bạn dùng hosting nhỏ hoặc server tự quản. Ba: khi traffic tăng đột ngột, CDN hấp thụ phần lớn request tĩnh, giúp site ít “sập” hơn so với chỉ dựa vào một máy chủ. One: pages open faster because heavy files are served near users. Two: the origin rests — fewer repeat image/CSS hits — helpful on small hosting or self-managed servers. Three: during spikes, the CDN absorbs most static requests so the site is less likely to fall over than with a single origin alone. One: pages open faster because heavy files are served near users. Two: the origin rests — fewer repeat image/CSS hits — helpful on small hosting or self-managed servers. Three: during spikes, the CDN absorbs most static requests so the site is less likely to fall over than with a single origin alone.
Nếu bạn đang học lộ trình Application Services trên hub này, CDN/cache là viên gạch nền trước khi đi sâu WAF, DDoS hay tối ưu API. Hiểu cache giúp bạn tránh lỗi phổ biến: “bật mọi thứ cache hết” rồi phát hiện form hoặc session bị lỗi. If you are following the Application Services track on this hub, CDN/cache is a foundation brick before deeper WAF, DDoS, or API tuning. Understanding cache helps you avoid the classic mistake: “cache everything” and then break forms or sessions. If you are following the Application Services track on this hub, CDN/cache is a foundation brick before deeper WAF, DDoS, or API tuning. Understanding cache helps you avoid the classic mistake: “cache everything” and then break forms or sessions.
Bắt đầu an toàn trong tuần đầu A safe first-week starting point A safe first-week starting point
Với người mới: ưu tiên cache tài nguyên tĩnh rõ ràng; kiểm tra trang đăng nhập và giỏ hàng vẫn đúng sau khi bật; học cách purge (xóa cache) khi deploy bản mới. Đọc thêm trang Content Delivery và bài sản phẩm CDN trên hub, rồi mở bài gốc trên blog.cloudflare.com khi muốn hiểu sâu cơ chế edge. For beginners: prefer clearly static assets; verify login and cart pages still behave after enabling cache; learn how to purge when you deploy. Read the Content Delivery page and the CDN product explainer on this hub, then open the original Cloudflare Blog posts when you want deeper edge mechanics. For beginners: prefer clearly static assets; verify login and cart pages still behave after enabling cache; learn how to purge when you deploy. Read the Content Delivery page and the CDN product explainer on this hub, then open the original Cloudflare Blog posts when you want deeper edge mechanics.
Câu hỏi tự kiểm tra: “Nếu Cloudflare giữ bản sao này 1 giờ, có ai bị lộ dữ liệu riêng không?” Nếu câu trả lời là có hoặc “không chắc”, hãy để nội dung đó ở chế độ không cache hoặc dùng quy tắc chặt hơn trước khi tối ưu thêm. Self-check question: “If Cloudflare kept this copy for an hour, could someone see private data?” If the answer is yes or “not sure,” leave that content uncached or use stricter rules before you optimize further. Self-check question: “If Cloudflare kept this copy for an hour, could someone see private data?” If the answer is yes or “not sure,” leave that content uncached or use stricter rules before you optimize further.
Câu hỏi thường gặp Frequently asked questions Frequently asked questions
CDN và hosting khác nhau chỗ nào? How is a CDN different from hosting? How is a CDN different from hosting?
Hosting (origin) lưu và chạy ứng dụng của bạn. CDN chủ yếu phân phối bản sao nội dung gần người dùng. Nhiều site dùng cả hai: origin tạo trang, CDN tăng tốc và giảm tải. Hosting (origin) stores and runs your app. A CDN mainly distributes copies of content near users. Many sites use both: origin builds the page, CDN speeds delivery and reduces load. Hosting (origin) stores and runs your app. A CDN mainly distributes copies of content near users. Many sites use both: origin builds the page, CDN speeds delivery and reduces load.
Có nên cache toàn bộ website không? Should you cache the entire website? Should you cache the entire website?
Không nên mặc định. Cache mạnh với ảnh, CSS, JS và trang tĩnh; thận trọng với trang cá nhân hóa, giỏ hàng và API. Sai cache nguy hiểm hơn chậm một chút. Not by default. Cache aggressively for images, CSS, JS, and static pages; be careful with personalized pages, carts, and APIs. Wrong cache is worse than being a bit slower. Not by default. Cache aggressively for images, CSS, JS, and static pages; be careful with personalized pages, carts, and APIs. Wrong cache is worse than being a bit slower.
Cloudflare Cache có thay thế tối ưu ảnh không? Does Cloudflare Cache replace image optimization? Does Cloudflare Cache replace image optimization?
Cache giúp giao ảnh nhanh hơn, nhưng ảnh vẫn nên có kích thước hợp lý. Cache và tối ưu ảnh bổ sung cho nhau, không thay thế nhau. Cache delivers images faster, but images should still be reasonably sized. Caching and image optimization complement each other; neither replaces the other. Cache delivers images faster, but images should still be reasonably sized. Caching and image optimization complement each other; neither replaces the other.
Học tiếp trên hub (on-page backlinks) Keep learning on this hub (on-page links) Keep learning on this hub (on-page links)
- Content Delivery trên hub Content Delivery on this hub Content Delivery on this hub
- CDN là gì? (trang sản phẩm) What is CDN? (product page) What is CDN? (product page)
- Lộ trình Application Services Application Services track Application Services track
- Use case: tăng tốc nội dung Use case: accelerate content delivery Use case: accelerate content delivery
- Cloudflare 101 Cloudflare 101 Cloudflare 101
Nguồn tham khảo (blog.cloudflare.com) Sources (blog.cloudflare.com) Sources (blog.cloudflare.com)
Nội dung được viết lại để dễ hiểu hơn; luôn đọc bài gốc trên blog.cloudflare.com và docs chính thức khi cần chi tiết kỹ thuật hoặc cập nhật mới nhất. Content is rewritten for clarity; always read the original posts on blog.cloudflare.com and official docs for technical detail or the latest updates. Content is rewritten for clarity; always read the original posts on blog.cloudflare.com and official docs for technical detail or the latest updates.