CDN CDN CDN Trung cấp Intermediate កម្រិតមធ្យម ~8 phút đọc · ~877 từ ~8 min read · ~772 words

Load Balancing Cloudflare: khi một server không đủ — tính sẵn sàng cao (H/A) đơn giản cho vận hành nhỏ Cloudflare Load Balancing: when one origin is not enough — simple High Availability (H/A) for small ops Cloudflare Load Balancing: when one origin is not enough — simple High Availability (H/A) for small ops

Load Balancing giống mở thêm quầy phục vụ: khách được chỉ vào quầy còn “khỏe”, quầy hỏng thì tự chuyển — website ít sập hơn khi một origin gặp sự cố. Load Balancing is like opening extra service counters: customers go to healthy ones, and failed counters drop out — your site stays up more often when one origin breaks. Load Balancing is like opening extra service counters: customers go to healthy ones, and failed counters drop out — your site stays up more often when one origin breaks.

Hình 1: Tổng quan luồng dữ liệu

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

Vì sao CDN cache không đủ khi origin “chết”? Why CDN cache is not enough when origin dies Why CDN cache is not enough when origin dies

CDN và cache giúp trang tĩnh mở nhanh và giảm tải origin — nhưng nhiều request vẫn phải về server gốc: đăng nhập, thanh toán, API động, hoặc nội dung cá nhân hóa. Nếu bạn chỉ có một origin và máy đó sập (disk full, deploy lỗi, datacenter mất điện), cache không thể “bịa” ra phiên đăng nhập hay đơn hàng mới. CDN and cache make static pages fast and lighten origin load — but many requests still reach origin: login, checkout, dynamic APIs, or personalized content. If you have only one origin and it fails (disk full, bad deploy, datacenter outage), cache cannot invent a login session or a new order. CDN and cache make static pages fast and lighten origin load — but many requests still reach origin: login, checkout, dynamic APIs, or personalized content. If you have only one origin and it fails (disk full, bad deploy, datacenter outage), cache cannot invent a login session or a new order.

Load Balancing (cân bằng tải) đặt một lớp điều phối trước nhiều origin: chia traffic theo quy tắc, kiểm tra sức khỏe định kỳ (health check), và tự loại server không phản hồi. Trên blog.cloudflare.com, các bài về load balancing và reliability thường kể câu chuyện “một điểm lỗi” — single point of failure — mà team nhỏ hay bỏ qua cho đến ngày traffic tăng hoặc incident đầu tiên. Load Balancing places a traffic director in front of multiple origins: split traffic by rules, run periodic health checks, and automatically drop unresponsive servers. Cloudflare Blog posts on load balancing and reliability often tell the “single point of failure” story that small teams ignore until traffic grows or the first incident hits. Load Balancing places a traffic director in front of multiple origins: split traffic by rules, run periodic health checks, and automatically drop unresponsive servers. Cloudflare Blog posts on load balancing and reliability often tell the “single point of failure” story that small teams ignore until traffic grows or the first incident hits.

Hãy tưởng tượng nhà hàng có một đầu bếp: CDN là khách lấy món có sẵn ở quầy salad; Load Balancing là có hai đầu bếp và quản lý chuyển khách sang bếp còn hoạt động khi một bếp hỏng bếp. Bạn vẫn cần cả hai lớp cho trải nghiệm tốt. Picture a restaurant with one chef: CDN is guests grabbing pre-made salad; Load Balancing is having two kitchens and sending diners to the working one when a stove fails. You often need both layers for a good experience. Picture a restaurant with one chef: CDN is guests grabbing pre-made salad; Load Balancing is having two kitchens and sending diners to the working one when a stove fails. You often need both layers for a good experience.

Hình 1: Tổng quan luồng dữ liệu

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

Health check và failover: ngôn ngữ vận hành không cần PhD Health checks and failover: ops language without a PhD Health checks and failover: ops language without a PhD

Health check là Worker hoặc probe của Cloudflare gọi URL trên mỗi origin (ví dụ `/healthz` trả 200). Nếu vài lần liên tiếp fail, origin bị đánh dấu “unhealthy” và ngừng nhận traffic mới. Failover là chuyển request sang origin còn sống hoặc pool dự phòng — có thể ở region khác. A health check is a Cloudflare probe calling a URL on each origin (for example `/healthz` returning 200). After several failures, the origin is marked unhealthy and stops receiving new traffic. Failover sends requests to surviving origins or a backup pool — possibly in another region. A health check is a Cloudflare probe calling a URL on each origin (for example `/healthz` returning 200). After several failures, the origin is marked unhealthy and stops receiving new traffic. Failover sends requests to surviving origins or a backup pool — possibly in another region.

Bạn có thể cấu hình trọng số (weighted): 80% traffic tới server mạnh, 20% tới server nhỏ để test. Hoặc geo routing: user châu Á về origin Singapore, user châu Âu về Frankfurt — giảm độ trễ so với một origin duy nhất ở Mỹ. You can set weights: 80% traffic to the big server, 20% to a smaller canary. Or geo routing: Asian users to a Singapore origin, European users to Frankfurt — lower latency than one US-only origin. You can set weights: 80% traffic to the big server, 20% to a smaller canary. Or geo routing: Asian users to a Singapore origin, European users to Frankfurt — lower latency than one US-only origin.

Điều quan trọng với team nhỏ: health endpoint phải thật — không trả 200 khi database đã chết. Nhiều sự cố production đến từ `/health` luôn OK trong khi app thực tế không login được. Blog Cloudflare về SRE và performance khuyên health check phản ánh dependency quan trọng (DB, queue) ở mức phù hợp độ phức tạp của bạn. What matters for small teams: the health endpoint must be honest — do not return 200 when the database is dead. Many production incidents come from `/health` always OK while the app cannot log in. Cloudflare Blog SRE and performance posts recommend health checks that reflect important dependencies (DB, queue) at a complexity level you can maintain. What matters for small teams: the health endpoint must be honest — do not return 200 when the database is dead. Many production incidents come from `/health` always OK while the app cannot log in. Cloudflare Blog SRE and performance posts recommend health checks that reflect important dependencies (DB, queue) at a complexity level you can maintain.

Khi nào team nhỏ nên bật Load Balancing? When should a small team turn on Load Balancing? When should a small team turn on Load Balancing?

Cân nhắc khi: (1) downtime 30 phút đã gây thiệt hại doanh thu hoặc uy tín; (2) bạn có thể chạy hai origin (hai VM, hai region, hoặc primary + standby); (3) deploy rolling cần một origin nhận traffic trong khi origin kia cập nhật. Chưa cần khi: site tĩnh hoàn toàn, traffic thấp, và bạn chấp nhận restore từ backup trong vài giờ. Consider it when: (1) 30 minutes of downtime hurts revenue or reputation; (2) you can run two origins (two VMs, two regions, or primary + standby); (3) rolling deploys need one origin serving while the other updates. You may skip it when: the site is fully static, traffic is low, and you accept hours to restore from backup. Consider it when: (1) 30 minutes of downtime hurts revenue or reputation; (2) you can run two origins (two VMs, two regions, or primary + standby); (3) rolling deploys need one origin serving while the other updates. You may skip it when: the site is fully static, traffic is low, and you accept hours to restore from backup.

Load Balancing không thay thế backup database hay kiểm thử deploy — nó chỉ giúp traffic không đổ vào server chết. Kết hợp với CDN (cache tĩnh), WAF (lọc request xấu), và monitoring (biết pool nào unhealthy) để có kiến trúc Application Services cân bằng. Load Balancing does not replace database backups or deploy testing — it only stops sending traffic to dead servers. Combine it with CDN (static cache), WAF (bad request filtering), and monitoring (know which pool is unhealthy) for a balanced Application Services architecture. Load Balancing does not replace database backups or deploy testing — it only stops sending traffic to dead servers. Combine it with CDN (static cache), WAF (bad request filtering), and monitoring (know which pool is unhealthy) for a balanced Application Services architecture.

Trên hub này, lộ trình Application Services và trang CDN giúp bạn đặt Load Balancing đúng chỗ trong “bức tranh lớn”. Đừng mua H/A vì FOMO — hãy bắt đầu từ health check thật và runbook khi failover xảy ra (ai được thông báo, làm gì với session sticky). On this hub, the Application Services track and CDN product page help you place Load Balancing in the bigger picture. Do not buy High Availability (H/A) from FOMO — start with honest health checks and a failover runbook (who gets paged, what to do about sticky sessions). On this hub, the Application Services track and CDN product page help you place Load Balancing in the bigger picture. Do not buy High Availability (H/A) from FOMO — start with honest health checks and a failover runbook (who gets paged, what to do about sticky sessions).

Checklist triển khai đơn giản trong tuần đầu A simple first-week deployment checklist A simple first-week deployment checklist

Một: tạo endpoint `/healthz` kiểm tra DB hoặc dependency tối thiểu. Hai: ít nhất hai origin đồng bộ code (cùng version hoặc blue/green có kế hoạch). Ba: cấu hình pool trên Cloudflare Load Balancing với health check interval hợp lý — quá ngắn tốn tài nguyên, quá dài failover chậm. Bốn: test bằng cách tắt một origin trong staging và xác nhận user vẫn vào được. One: create a `/healthz` endpoint that checks the DB or minimal dependencies. Two: run at least two origins on the same code (same version or a planned blue/green). Three: configure a pool in Cloudflare Load Balancing with sensible health intervals — too aggressive wastes resources, too slow delays failover. Four: test by shutting down one origin in staging and confirm users still get through. One: create a `/healthz` endpoint that checks the DB or minimal dependencies. Two: run at least two origins on the same code (same version or a planned blue/green). Three: configure a pool in Cloudflare Load Balancing with sensible health intervals — too aggressive wastes resources, too slow delays failover. Four: test by shutting down one origin in staging and confirm users still get through.

Năm: document session affinity — nếu app cần sticky session, hiểu Cloudflare và origin xử lý cookie thế nào khi failover. Sáu: kết hợp với Page Rules hoặc Cache Rules để không cache trang cần origin sống. Đọc bài CDN/cache trong blog hub nếu chưa — H/A không cứu được trang dynamic bị cache sai. Five: document session affinity — if the app needs sticky sessions, understand how Cloudflare and origin handle cookies on failover. Six: pair with Page Rules or Cache Rules so dynamic pages are not wrongly cached. Read the CDN/cache posts on this hub if needed — High Availability (H/A) cannot fix wrongly cached dynamic pages. Five: document session affinity — if the app needs sticky sessions, understand how Cloudflare and origin handle cookies on failover. Six: pair with Page Rules or Cache Rules so dynamic pages are not wrongly cached. Read the CDN/cache posts on this hub if needed — High Availability (H/A) cannot fix wrongly cached dynamic pages.

Mở bài gốc trên blog.cloudflare.com về load balancing để cập nhật tính năng mới (active monitoring, spectrum, multi-cloud). Câu hỏi tự kiểm tra: “Nếu origin A chết lúc 2 giờ sáng, ai thức dậy và quy trình gì?” Nếu chưa có câu trả lời, H/A kỹ thuật chưa đủ — cần runbook con người. Open original blog.cloudflare.com load balancing posts for newer features (active monitoring, Spectrum, multi-cloud). Self-check: “If origin A dies at 2 a.m., who wakes up and what is the process?” If there is no answer, technical High Availability (H/A) is incomplete — you need a human runbook. Open original blog.cloudflare.com load balancing posts for newer features (active monitoring, Spectrum, multi-cloud). Self-check: “If origin A dies at 2 a.m., who wakes up and what is the process?” If there is no answer, technical High Availability (H/A) is incomplete — you need a human runbook.

Hình minh họa Cloudflare Cloudflare visuals Cloudflare visuals

Sơ đồ Reference Architecture chính thức và (khi có) ảnh Dashboard — giúp đối chiếu khi học. Official Reference Architecture diagrams and (when available) Dashboard screenshots — useful while you learn. Official Reference Architecture diagrams and (when available) Dashboard screenshots — useful while you learn.

Hình 1: Cloudflare Image Resizing and R2

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

Câu hỏi thường gặp Frequently asked questions Frequently asked questions

Load Balancing có thay CDN không? Does Load Balancing replace a CDN? Does Load Balancing replace a CDN?

Không. CDN cache và phân phối nội dung tĩnh gần user. Load Balancing điều phối request tới nhiều origin. Hầu hết site production dùng cả hai. No. CDN caches and delivers static content near users. Load Balancing directs requests across multiple origins. Most production sites use both. No. CDN caches and delivers static content near users. Load Balancing directs requests across multiple origins. Most production sites use both.

Cần mấy origin tối thiểu để có tính sẵn sàng cao (H/A)? How many origins do I need minimum for High Availability (H/A)? How many origins do I need minimum for High Availability (H/A)?

Thực tế ít nhất hai origin (hoặc primary + standby có thể kích hoạt). Một origin + Load Balancing không tạo H/A thật — vẫn là single point of failure. Practically at least two origins (or primary + standby you can activate). One origin plus Load Balancing is not real High Availability (H/A) — still a single point of failure. Practically at least two origins (or primary + standby you can activate). One origin plus Load Balancing is not real High Availability (H/A) — still a single point of failure.

Health check fail nhưng site vẫn “vào được” — sao? Health check fails but the site still “works” — why? Health check fails but the site still “works” — why?

Có thể user đang nhận cache CDN, hoặc health endpoint quá đơn giản không phản ánh lỗi thật. Hãy kiểm tra path động và đồng bộ health với trải nghiệm login/checkout. Users may be getting CDN cache, or your health endpoint is too shallow to reflect real failure. Test dynamic paths and align health with login/checkout experience. Users may be getting CDN cache, or your health endpoint is too shallow to reflect real failure. Test dynamic paths and align health with login/checkout experience.

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)

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.

What is a CDN? Understanding Cloudflare Cache in plain language
CDN CDN CDN Cơ bản Entry កម្រិតចាប់ផ្តើម ~6 phút ~6 min ~6 នាទី

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.

Đọc bài → Read post → អានអត្ថបទ →

What is a WAF? Cloudflare website protection explained for non-specialists
Bảo mật Security សុវត្ថិភាព Cơ bản Entry កម្រិតចាប់ផ្តើម ~7 phút ~7 min ~7 នាទី

WAF là gì? Bảo vệ website Cloudflare theo cách người không chuyên IT cũng hiểu What is a WAF? Cloudflare website protection explained for non-specialists What is a WAF? Cloudflare website protection explained for non-specialists

WAF giống bảo vệ cửa ra vào của website: xem ai đang gõ cửa, chặn hành vi đáng ngờ, rồi mới cho vào bên trong (origin). A WAF is like a doorman for your website: it checks who is knocking, blocks suspicious behavior, then lets safe traffic through to your origin. A WAF is like a doorman for your website: it checks who is knocking, blocks suspicious behavior, then lets safe traffic through to your origin.

Đọc bài → Read post → អានអត្ថបទ →

Cloudflare Developer Platform: build global apps without managing servers yourself
Developer Platform Developer Platform Developer Platform Trung cấp Intermediate កម្រិតមធ្យម ~9 phút ~9 min ~9 នាទី

Cloudflare Developer Platform: xây ứng dụng toàn cầu mà không tự quản lý server Cloudflare Developer Platform: build global apps without managing servers yourself Cloudflare Developer Platform: build global apps without managing servers yourself

Developer Platform giống bộ lego edge: compute (Workers), hộp đựng (R2/KV/D1), AI, và lớp bảo vệ — lắp theo use case thay vì mua cả trung tâm dữ liệu. The Developer Platform is like an edge Lego set: compute (Workers), storage boxes (R2/KV/D1), AI, and protection layers — assemble by use case instead of buying a whole data center. The Developer Platform is like an edge Lego set: compute (Workers), storage boxes (R2/KV/D1), AI, and protection layers — assemble by use case instead of buying a whole data center.

Đọc bài → Read post → អានអត្ថបទ →

Xem tất cả bài blog Browse all blog posts Browse all blog posts

Chuỗi bài AI · Security · CDN · Workers · Developer Platform — viết lại cho người mới và trung cấp. AI · Security · CDN · Workers · Developer Platform — rewritten for entry and intermediate learners. AI · Security · CDN · Workers · Developer Platform — rewritten for entry and intermediate learners.