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 đó.
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.
Hiểu các thành phần cơ bản để biết khi nào triển khai phần nào trước.
Datacenters phân tán toàn cầu (Cloudflare: 300+ cities, AWS: 400+). Mỗi PoP chạy code cho user gần đó.
V8 isolate (Cloudflare Workers, Vercel Edge) hoặc Firecracker MicroVM (AWS Lambda@Edge). Cold start <5ms vs traditional Lambda 200-1000ms.
1 IP route automatic tới PoP gần nhất theo BGP routing. User không cần config — magic tự động.
Distributed storage tại edge: Cloudflare KV, Durable Objects, R2. Read latency <50ms global.
SQLite (Cloudflare D1), Postgres (Neon edge), distributed globally. Latency thấp cho read, write replicate.
Không phải "tăng năng suất chung chung" — đây là con số thực từ các dự án Alodev đã triển khai.
User VN gọi origin US: 200-500ms. Edge HN PoP: 20-50ms. Cảm nhận rõ rệt — app feel 'instant'.
Mỗi PoP handle traffic riêng. Không bottleneck single origin. 1M user đồng thời xử lý dễ.
Cloudflare Workers free tier 100k req/ngày. Workers paid $0.50/1M req. Vs traditional cloud $5-50/1M req.
Distributed = absorb attack distributed. Cloudflare absorb 100Tbps DDoS, traditional cloud sẽ down.
Nếu ≥2/4 dấu hiệu dưới đúng với hiện trạng, là thời điểm phù hợp để bàn.
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.
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.
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.
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: (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).