Bỏ qua menu, vào nội dung chính
Chủ đề:  Edge Computing
Thành phần:  5 mục

Edge Computing là kiến trúc chạy code (compute) trên servers gần geographic user, thay vì 1 server tập trung (origin). Khi user ở Hà Nội request → code chạy tại Cloudflare Hanoi PoP (latency <30ms) thay vì tại origin server US (>200ms). Tăng tốc cho web app + API global.

Edge computing là evolution từ CDN truyền thống (chỉ cache static files) sang full compute platform (chạy app logic). Cloudflare Workers tiên phong (2018), giờ AWS Lambda@Edge, Vercel Edge Functions, Deno Deploy đều cạnh tranh. Game changer cho UX global apps.

Thành phần chính.

  1. 01

    Edge PoP (Point of Presence)

    Datacenters phân tán toàn cầu (Cloudflare: 300+ cities, AWS: 400+). Mỗi PoP chạy code cho user gần đó.

  2. 02

    Edge Runtime

    V8 isolate (Cloudflare Workers, Vercel Edge) hoặc Firecracker MicroVM (AWS Lambda@Edge). Cold start <5ms vs traditional Lambda 200-1000ms.

  3. 03

    Anycast Routing

    1 IP route automatic tới PoP gần nhất theo BGP routing. User không cần config - magic tự động.

  4. 04

    Edge KV / Object Storage

    Distributed storage tại edge: Cloudflare KV, Durable Objects, R2. Read latency <50ms global.

  5. 05

    Edge DB

    SQLite (Cloudflare D1), Postgres (Neon edge), distributed globally. Latency thấp cho read, write replicate.

Lợi ích
  • Latency giảm 5-10x. User VN gọi origin US: 200-500ms. Edge HN PoP: 20-50ms. Cảm nhận rõ rệt - app feel 'instant'.
  • Scale auto vô hạn. Mỗi PoP handle traffic riêng. Không bottleneck single origin. 1M user đồng thời xử lý dễ.
  • Cost hiệu quả. Cloudflare Workers free tier 100k req/ngày. Workers paid $0.50/1M req. Vs traditional cloud $5-50/1M req.
  • DDoS resilience. Distributed = absorb attack distributed. Cloudflare absorb 100Tbps DDoS, traditional cloud sẽ down.
Nên triển khai khi
  • User toàn cầu hoặc nhiều khu vực VN - latency single origin cao
  • API auth / rate limit / image transform - không cần state phức tạp
  • Cần global low-latency cho redirect, A/B test, geo-routing
  • Cost cloud origin đang cao - edge tier free + cheap hơn

Câu hỏi thường gặp.

Edge Computing vs CDN truyền thống khác gì?

CDN truyền thống (CloudFront, Akamai legacy): chỉ cache static files (images, CSS, JS), không chạy code. Edge Computing: cache static + chạy code tại edge (auth, API, image transform). Modern CDN (Cloudflare, Fastly) đều là edge computing platform. CDN cũ chỉ là 1 phần edge.

Edge Functions có thể replace backend hoàn toàn không?

Cho ~60% use case có. Limitations: max 30s execution (Cloudflare free), 50ms CPU. Không phù hợp: heavy computation, long-running tasks, complex DB transactions. Phù hợp: API CRUD đơn giản, auth, payment webhook, image transform, edge cache. Combine với managed DB (Neon, Supabase) cho full backend.

Edge DB như Cloudflare D1 vs PostgreSQL?

D1 (SQLite distributed): read latency <50ms global, write 100-300ms (replicate). Phù hợp app read-heavy global. PostgreSQL: feature rich (JSONB, FTS, extensions), single region default. Phù hợp app phức tạp. Hybrid: D1 cho global cache + PG cho master data.

Cost edge vs traditional cloud?

Cloudflare Workers: 100k req/ngày free, $0.50/1M paid. AWS Lambda: 1M req/tháng free, $0.20/1M paid (nhưng cold start chậm hơn). Edge tiết kiệm 60-80% cost vs traditional Lambda + better latency. Sweet spot cho SME web app.

Khi nào KHÔNG nên dùng edge?

Khi: (1) Data residency strict - phải lưu tại 1 region (Nghị định 13 cho data nhạy cảm VN), (2) Logic phức tạp + long execution time, (3) Tight integration với legacy on-premise systems, (4) Đội chưa biết edge programming model (khác từ traditional server).

Áp vào doanh nghiệp
thì bắt đầu từ đâu?

Mô tả bài toán, ALODEV tư vấn đúng nghiệp vụ, miễn phí.