Better Uptime Edge Monitoring
Better Uptime Edge Deployment Multi-region Monitoring CDN Cloudflare Workers Vercel Fly.io Status Page Incident Management Alert
| Monitor Type | Check | Interval | Use Case |
|---|---|---|---|
| HTTP Monitor | Status Code + Response Time | 30s (Pro) | เว็บไซต์ API Endpoint |
| Keyword Monitor | Response Body มีคำสำคัญ | 30s | ตรวจ Content ถูกต้อง |
| Heartbeat | รอรับ Ping จาก Service | ตาม Schedule | Cron Job Background Task |
| API Monitor | POST/PUT/DELETE + Assertion | 30s | API Functional Test |
| TCP Monitor | TCP Port Open | 30s | Database Redis Custom Port |
Multi-region Setup
# === Edge Monitoring Configuration ===
from dataclasses import dataclass
@dataclass
class EdgeMonitor:
region: str
endpoint: str
check_locations: str
expected_latency: str
alert_threshold: str
monitors = [
EdgeMonitor("US East (Virginia)",
"https://us-east.example.com/health",
"New York, Chicago, Dallas",
"< 50ms",
"Response Time > 200ms หรือ Status != 200"),
EdgeMonitor("US West (Oregon)",
"https://us-west.example.com/health",
"Los Angeles, San Francisco, Seattle",
"< 50ms",
"Response Time > 200ms หรือ Status != 200"),
EdgeMonitor("EU West (Frankfurt)",
"https://eu.example.com/health",
"London, Frankfurt, Amsterdam",
"< 80ms",
"Response Time > 300ms หรือ Status != 200"),
EdgeMonitor("Asia (Singapore)",
"https://asia.example.com/health",
"Singapore, Tokyo, Sydney",
"< 100ms",
"Response Time > 400ms หรือ Status != 200"),
EdgeMonitor("Global (Anycast)",
"https://example.com/health",
"All Locations (10+)",
"< 200ms (worst case)",
"2+ Locations Fail → Global Alert"),
]
print("=== Edge Monitors ===")
for m in monitors:
print(f" [{m.region}]")
print(f" URL: {m.endpoint}")
print(f" Check from: {m.check_locations}")
print(f" Expected: {m.expected_latency}")
print(f" Alert: {m.alert_threshold}")
Status Page & Incident
# === Status Page Components ===
@dataclass
class StatusComponent:
component: str
group: str
monitor_id: str
sla_target: str
current_status: str
components = [
StatusComponent("API Gateway",
"Global Services",
"HTTP Monitor → api.example.com",
"99.99% (52.6 min downtime/year)",
"Operational"),
StatusComponent("Edge CDN US",
"US Region",
"HTTP Monitor → us.example.com",
"99.95% (4.38 hr downtime/year)",
"Operational"),
StatusComponent("Edge CDN EU",
"EU Region",
"HTTP Monitor → eu.example.com",
"99.95%",
"Operational"),
StatusComponent("Edge CDN Asia",
"Asia Region",
"HTTP Monitor → asia.example.com",
"99.9% (8.77 hr downtime/year)",
"Degraded Performance"),
StatusComponent("Database (Primary)",
"Infrastructure",
"TCP Monitor → db-primary:5432",
"99.99%",
"Operational"),
StatusComponent("Background Jobs",
"Infrastructure",
"Heartbeat Monitor → /heartbeat",
"99.9%",
"Operational"),
]
print("=== Status Page ===")
for c in components:
emoji = "OK" if c.current_status == "Operational" else "WARN"
print(f" [{emoji}] {c.component} ({c.group})")
print(f" Monitor: {c.monitor_id}")
print(f" SLA: {c.sla_target}")
print(f" Status: {c.current_status}")
Incident Workflow
# === Incident Management ===
@dataclass
class IncidentStep:
step: str
owner: str
time_target: str
action: str
tool: str
incident_flow = [
IncidentStep("Alert Triggered",
"Better Uptime",
"Instant",
"ตรวจพบ Monitor Fail ส่ง Alert",
"Better Uptime → Slack + PagerDuty"),
IncidentStep("Acknowledge",
"On-call Engineer",
"< 5 minutes",
"กด Acknowledge รับ Incident",
"PagerDuty App / Slack Button"),
IncidentStep("Triage",
"On-call Engineer",
"< 10 minutes",
"ตรวจ Scope Regional/Global ตั้ง Priority P1-P4",
"Better Uptime Dashboard + Grafana"),
IncidentStep("Update Status Page",
"On-call Engineer",
"< 15 minutes",
"แจ้ง User ว่ากำลังตรวจสอบ",
"Better Uptime Status Page"),
IncidentStep("Investigate & Fix",
"Engineering Team",
"< 30 min (P1) < 2hr (P2)",
"หา Root Cause แก้ไข Deploy Fix",
"Logs Metrics Runbook"),
IncidentStep("Resolve & Verify",
"On-call Engineer",
"หลัง Fix",
"ตรวจ Monitor กลับ OK Update Status Resolved",
"Better Uptime + Smoke Test"),
IncidentStep("Post-mortem",
"Team Lead",
"< 48 hours",
"เขียน Root Cause Timeline Action Items",
"Confluence / Notion Template"),
]
print("=== Incident Flow ===")
for s in incident_flow:
print(f" [{s.step}] Owner: {s.owner}")
print(f" Target: {s.time_target}")
print(f" Action: {s.action}")
print(f" Tool: {s.tool}")
เคล็ดลับ
- Multi-location: ตรวจจากหลาย Location แยก Regional vs Global Issue
- Status Page: สร้าง Status Page แจ้ง User ลดภาระ Support
- Heartbeat: ใช้ Heartbeat ตรวจ Background Job ไม่ใช่แค่ HTTP
- Escalation: ตั้ง Escalation 2+ Location Fail = P1
- Post-mortem: เขียน Post-mortem ทุก Incident ป้องกันเกิดซ้ำ
การนำความรู้ไปประยุกต์ใช้งานจริง
แหล่งเรียนรู้ที่แนะนำ ได้แก่ Official Documentation ที่อัพเดทล่าสุดเสมอ Online Course จาก Coursera Udemy edX ช่อง YouTube คุณภาพทั้งไทยและอังกฤษ และ Community อย่าง Discord Reddit Stack Overflow ที่ช่วยแลกเปลี่ยนประสบการณ์กับนักพัฒนาทั่วโลก
เปรียบเทียบข้อดีและข้อเสีย
จากตารางเปรียบเทียบจะเห็นว่าข้อดีมีมากกว่าข้อเสียอย่างชัดเจน โดยเฉพาะในแง่ของประสิทธิภาพและความสามารถในการ Scale สำหรับข้อเสียส่วนใหญ่สามารถแก้ไขได้ด้วยการเรียนรู้อย่างเป็นระบบและวางแผนทรัพยากรให้เหมาะสม
Edge Deployment Monitoring คืออะไร
ตรวจ App กระจาย Edge CDN Cloudflare Workers Vercel Fly.io Multi-location 10+ Region Latency Response Time 30s Interval Alert
ตั้งค่า Multi-region Monitor อย่างไร
HTTP Keyword Heartbeat API Monitor Multi-location Check Regional vs Global Alert Slack PagerDuty Escalation 2+ Location P1
Status Page สร้างอย่างไร
Public Status Page Component Group Region Incident Timeline Maintenance Subscriber Custom Domain Branding Uptime SLA % Response Graph
Incident Management ทำอย่างไร
Alert Acknowledge 5min Triage Priority Status Page Update Fix Resolve Verify Post-mortem MTTA MTTR Runbook Escalation
สรุป
Better Uptime Edge Deployment Multi-region Monitoring Status Page Incident Management Alert Escalation Post-mortem MTTA MTTR Production
