Workers Workers Workers Cơ bản Entry កម្រិតចាប់ផ្តើម ~7 phút đọc · ~613 từ ~7 min read · ~511 words

Cloudflare Workers là gì? Serverless ở “mép mạng” giải thích đơn giản What are Cloudflare Workers? Serverless at the edge, explained simply What are Cloudflare Workers? Serverless at the edge, explained simply

Workers giống thuê “người trực” ngay gần khách hàng: nhận request, xử lý nhanh, trả kết quả — bạn không phải tự mua và bảo trì cả tòa nhà server. Workers are like stationing helpers near customers: take a request, handle it quickly, return a result — without buying and maintaining a whole server building. Workers are like stationing helpers near customers: take a request, handle it quickly, return a result — without buying and maintaining a whole server building.

Hình 1: Cloudflare Developer Platform

Ứng dụng fullstack Fullstack applications Fullstack applications

Ví dụ fullstack trên Developer Platform — Workers/Pages, storage và AI services trong một kiến trúc thực tế. A practical example of how these services come together in a real fullstack application architecture. A practical example of how these services come together in a real fullstack application architecture.

Thuật ngữ: Concepts: Concepts: Workers · Pages · D1 · R2 · KV · Durable Objects

Sơ đồ chính thức ↗ Official diagram ↗ Official diagram ↗ · Serverless Serverless Serverless

Server truyền thống vs Workers: khác nhau ở trách nhiệm của bạn Traditional servers vs Workers: what you are responsible for Traditional servers vs Workers: what you are responsible for

Với server truyền thống hoặc VPS, bạn (hoặc team) thường lo hệ điều hành, bản vá, dung lượng đĩa, và “máy còn sống lúc 3 giờ sáng không”. Với mô hình serverless như Cloudflare Workers, bạn tập trung vào đoạn code xử lý request; Cloudflare lo việc chạy code trên mạng toàn cầu. With a traditional server or VPS, you (or your team) often own the OS, patches, disk space, and “is the box alive at 3 a.m.?” With serverless like Cloudflare Workers, you focus on the code that handles a request; Cloudflare runs it on a global network. With a traditional server or VPS, you (or your team) often own the OS, patches, disk space, and “is the box alive at 3 a.m.?” With serverless like Cloudflare Workers, you focus on the code that handles a request; Cloudflare runs it on a global network.

“Edge” nghĩa là điểm gần người dùng trong mạng Cloudflare. Thay vì mọi logic API phải về một region cố định, Workers có thể thực thi gần nơi request xuất hiện — hữu ích cho xác thực, chuyển hướng, A/B nhẹ, ghép header bảo mật, hoặc API nhỏ. “Edge” means a location closer to the user on Cloudflare’s network. Instead of every API call returning to one fixed region, Workers can run near where the request appears — useful for auth checks, redirects, light A/B tests, security headers, or small APIs. “Edge” means a location closer to the user on Cloudflare’s network. Instead of every API call returning to one fixed region, Workers can run near where the request appears — useful for auth checks, redirects, light A/B tests, security headers, or small APIs.

Blog chính thức của Cloudflare thường mô tả Workers như viên gạch trung tâm của Developer Platform: từ đó bạn nối thêm R2 (lưu file), D1 (database), KV, AI, và nhiều dịch vụ khác bằng bindings — cách “gắn” tài nguyên vào Worker mà không nhúng secret lung tung trong code frontend. The official Cloudflare Blog often describes Workers as the center brick of the Developer Platform: from there you attach R2 (object storage), D1 (database), KV, AI, and more via bindings — a way to wire resources into a Worker without scattering secrets in frontend code. The official Cloudflare Blog often describes Workers as the center brick of the Developer Platform: from there you attach R2 (object storage), D1 (database), KV, AI, and more via bindings — a way to wire resources into a Worker without scattering secrets in frontend code.

Hình 1: Kiến trúc truyền thống một vùng

API serverless toàn cầu Serverless global APIs Serverless global APIs

Ví dụ kiến trúc API serverless trên Cloudflare — compute và data product (Workers, D1, R2) tương tác thế nào. An example architecture of a serverless API on Cloudflare and aims to illustrate how different compute and data products could interact with each other. An example architecture of a serverless API on Cloudflare and aims to illustrate how different compute and data products could interact with each other.

Thuật ngữ: Concepts: Concepts: Workers · D1 · R2 · Global API · Edge compute

Sơ đồ chính thức ↗ Official diagram ↗ Official diagram ↗ · Serverless Serverless Serverless

Ví dụ đời thực cho người chưa phải kỹ sư hệ thống Real-life examples if you are not a systems engineer Real-life examples if you are not a systems engineer

Ví dụ 1: form đăng ký workshop gửi vào API. Worker nhận dữ liệu, kiểm tra cơ bản, ghi vào D1, trả lời JSON. Bạn không cần mở một server Node.js 24/7 chỉ vì vài chục đăng ký mỗi ngày. Example 1: a workshop signup form posts to an API. A Worker receives the payload, does basic checks, writes to D1, returns JSON. You do not need a 24/7 Node.js server just for a few dozen signups a day. Example 1: a workshop signup form posts to an API. A Worker receives the payload, does basic checks, writes to D1, returns JSON. You do not need a 24/7 Node.js server just for a few dozen signups a day.

Ví dụ 2: website marketing cần thêm header bảo mật hoặc chuyển ngôn ngữ theo đường dẫn. Worker đứng trước origin, chỉnh response nhanh — giống “lễ tân” sửa hướng dẫn trước khi khách vào bên trong. Example 2: a marketing site needs security headers or language redirects. A Worker sits in front of origin and adjusts the response quickly — like a receptionist updating directions before guests walk inside. Example 2: a marketing site needs security headers or language redirects. A Worker sits in front of origin and adjusts the response quickly — like a receptionist updating directions before guests walk inside.

Ví dụ 3: tạo API trả QR, rút gọn link, hoặc webhook Slack. Đây là các tutorial phổ biến trên docs Cloudflare — và cũng là lý do hub này có lộ trình Developer Platform cùng trang sản phẩm Workers. Example 3: an API that returns QR codes, short links, or Slack webhooks. These are common Cloudflare docs tutorials — and why this hub has a Developer Platform track plus a Workers product page. Example 3: an API that returns QR codes, short links, or Slack webhooks. These are common Cloudflare docs tutorials — and why this hub has a Developer Platform track plus a Workers product page.

Workers không phải phép màu — giới hạn tư duy giúp bạn chọn đúng Workers are not magic — healthy limits help you choose well Workers are not magic — healthy limits help you choose well

Workers rất mạnh cho tác vụ ngắn, gắn với request/response hoặc workflow được thiết kế cho nền tảng. Nếu bạn cần máy ảo chạy tiến trình nặng hàng giờ theo kiểu desktop, đó là bài toán khác (container/VM). Hiểu ranh giới giúp tránh thất vọng. Workers shine for short tasks tied to request/response or platform-native workflows. If you need a VM running heavy desktop-style jobs for hours, that is a different problem (containers/VMs). Knowing the boundary prevents disappointment. Workers shine for short tasks tied to request/response or platform-native workflows. If you need a VM running heavy desktop-style jobs for hours, that is a different problem (containers/VMs). Knowing the boundary prevents disappointment.

Người mới nên bắt đầu từ một Worker “Hello”, rồi nối một binding đơn giản, rồi mới tới AI hoặc hệ thống phức tạp. Đọc tiếp bài Workers AI và Developer Platform trong blog này; đồng thời mở bài gốc trên blog.cloudflare.com khi bạn sẵn sàng đi sâu kiến trúc. Beginners should start with a “Hello” Worker, then one simple binding, then AI or richer systems. Continue with the Workers AI and Developer Platform posts in this blog; open original Cloudflare Blog architecture posts when you are ready to go deeper. Beginners should start with a “Hello” Worker, then one simple binding, then AI or richer systems. Continue with the Workers AI and Developer Platform posts in this blog; open original Cloudflare Blog architecture posts when you are ready to go deeper.

Nếu mục tiêu của bạn là giữ chân người học trên hub: hãy dùng Workers như cầu nối từ lý thuyết CDN/WAF sang “tôi có thể xây được thứ gì đó”. Mỗi lần bạn deploy thành công một Worker, khái niệm edge trở nên cụ thể. If your goal is durable learning on this hub: treat Workers as the bridge from CDN/WAF theory to “I can build something.” Each successful Worker deploy makes the edge concept concrete. If your goal is durable learning on this hub: treat Workers as the bridge from CDN/WAF theory to “I can build something.” Each successful Worker deploy makes the edge concept concrete.

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

Workers có cần thẻ tín dụng ngay không? Do I need a credit card to try Workers? Do I need a credit card to try Workers?

Cloudflare thường có mức Free để học và thử nghiệm. Luôn kiểm tra bảng giá và giới hạn hiện tại trên trang chính thức trước khi đưa vào production. Cloudflare typically offers a Free tier for learning and experiments. Always check current pricing and limits on the official site before production use. Cloudflare typically offers a Free tier for learning and experiments. Always check current pricing and limits on the official site before production use.

Workers thay thế được website WordPress không? Can Workers replace a WordPress site? Can Workers replace a WordPress site?

Không phải lúc nào cũng vậy. Workers giỏi xử lý logic/API/edge; WordPress là CMS đầy đủ. Nhiều đội dùng cả hai: WordPress (hoặc origin khác) phía sau, Workers/CDN/WAF phía trước. Not always. Workers excel at logic/APIs/edge; WordPress is a full CMS. Many teams use both: WordPress (or another origin) behind, Workers/CDN/WAF in front. Not always. Workers excel at logic/APIs/edge; WordPress is a full CMS. Many teams use both: WordPress (or another origin) behind, Workers/CDN/WAF in front.

Nên học Workers trước hay CDN/WAF trước? Should I learn Workers before CDN/WAF? Should I learn Workers before CDN/WAF?

Nếu bạn vận hành website có sẵn, học DNS/proxy/CDN/WAF trước sẽ thực tế hơn. Nếu bạn là developer muốn xây API, có thể bắt đầu Workers sớm — vẫn nên hiểu proxy và bảo mật cơ bản. If you already run a website, DNS/proxy/CDN/WAF first is more practical. If you are a developer building APIs, you can start Workers early — but still learn basic proxy and security ideas. If you already run a website, DNS/proxy/CDN/WAF first is more practical. If you are a developer building APIs, you can start Workers early — but still learn basic proxy and security ideas.

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 Workers AI? Run AI models on Cloudflare without managing GPUs yourself
AI AI AI Cơ bản Entry កម្រិតចាប់ផ្តើម ~8 phút ~8 min ~8 នាទី

Workers AI là gì? Chạy mô hình AI trên Cloudflare mà không tự quản lý GPU What is Workers AI? Run AI models on Cloudflare without managing GPUs yourself What is Workers AI? Run AI models on Cloudflare without managing GPUs yourself

Workers AI giống thuê bếp công nghiệp đã sẵn sàng: bạn gọi món (mô hình), nhận kết quả — không phải tự xây nhà bếp GPU. Workers AI is like renting a ready commercial kitchen: you order a dish (model), get results — without building your own GPU kitchen. Workers AI is like renting a ready commercial kitchen: you order a dish (model), get results — without building your own GPU kitchen.

Đọ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 → អានអត្ថបទ →

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 → អានអត្ថបទ →

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.