EdgeFlow CDN edge node — high-performance HTTP/HTTPS reverse proxy with caching.
flowchart LR
Client[Client] --> Edge[Edge Proxy :8080]
Edge --> MemCache[Memory Cache<br/>Sharded LRU]
Edge --> DiskCache[Disk Cache<br/>Hash Bucketed]
Edge --> Origin[Origin Server]
Edge --> Metrics[Prometheus :9100]
CP[Control Plane] -->|gRPC Config Sync| Edge
Redis[(Redis)] -->|Pub/Sub Purge| Edge
Edge -->|Access Logs| CH[(ClickHouse)]
- HTTP/HTTPS reverse proxy with Host-based domain routing
- Two-tier LRU cache: sharded in-memory + hash-bucketed disk
- Cache-Control header parsing (s-maxage, max-age, Expires)
- Origin fetch with singleflight request coalescing and retry
- Origin strategies: round-robin, weighted, primary-backup
- HTTPS with SNI support (TLS 1.2+, HTTP/2)
- Let's Encrypt / ACME auto certificate management
- Per-IP token bucket rate limiting
- Anti-hotlinking (Referer whitelist + signed URL)
- Prometheus metrics (
/metrics) and health check (/health) - Structured JSON access logging
- ClickHouse log shipping (async batched)
- gRPC client for control plane config sync
- Redis pub/sub for cache purge broadcast
# Build
go build -o bin/cdn-edge ./cmd
# Run
./bin/cdn-edge -config configs/edge-config.yaml
# Docker
docker build -t cdn-edge .
docker run -p 8080:8080 cdn-edgeSee configs/edge-config.yaml for all options.
- Memory cache Get: ~9.5M ops/sec (zero allocs)
- Full proxy cache hit: ~32K QPS (~37μs/op)
- Target: >10K QPS, P99 <5ms on cache hit
go test ./... -race -count=1
go test ./cache/... -bench=. -benchmem