Better Uptime Edge Monitoring

Better Uptime Edge Deployment Multi-region Monitoring CDN Cloudflare Workers Vercel Fly.io Status Page Incident Management Alert

Monitor TypeCheckIntervalUse Case
HTTP MonitorStatus Code + Response Time30s (Pro)เว็บไซต์ API Endpoint
Keyword MonitorResponse Body มีคำสำคัญ30sตรวจ Content ถูกต้อง
Heartbeatรอรับ Ping จาก Serviceตาม ScheduleCron Job Background Task
API MonitorPOST/PUT/DELETE + Assertion30sAPI Functional Test
TCP MonitorTCP Port Open30sDatabase 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 ที่ช่วยแลกเปลี่ยนประสบการณ์กับนักพัฒนาทั่วโลก

เปรียบเทียบข้อดีและข้อเสีย

ข้อดีข้อเสีย
ประสิทธิภาพสูง ทำงานได้เร็วและแม่นยำ ลดเวลาทำงานซ้ำซ้อนต้องใช้เวลาเรียนรู้เบื้องต้นพอสมควร มี Learning Curve สูง
มี Community ขนาดใหญ่ มีคนช่วยเหลือและแหล่งเรียนรู้มากมายบางฟีเจอร์อาจยังไม่เสถียร หรือมีการเปลี่ยนแปลงบ่อยในเวอร์ชันใหม่
รองรับ Integration กับเครื่องมือและบริการอื่นได้หลากหลายต้นทุนอาจสูงสำหรับ Enterprise License หรือ Cloud Service
เป็น Open Source หรือมีเวอร์ชันฟรีให้เริ่มต้นใช้งานต้องการ Hardware หรือ Infrastructure ที่เพียงพอ

จากตารางเปรียบเทียบจะเห็นว่าข้อดีมีมากกว่าข้อเสียอย่างชัดเจน โดยเฉพาะในแง่ของประสิทธิภาพและความสามารถในการ 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