Multi-tenant SaaS Platforms — Cells, Rings & Progressive Delivery›07 · The global edge

Lesson 07 of 16 · Edge, isolation and cost

The global edge

Design what sits in front of every cell: an anycast CDN and WAF close to users, TLS re-encrypted to the cells, tenant routing, per-tenant rate limits that work across many gateway replicas, trace context from the first hop, and a plan for losing a region.

Architect
Key wordsglobal edgeanycastCDNWAFDDoS protectionTLS terminationre-encryptiontenant routingrate limitingglobal rate limit servicetraceparentregional failoverorigin protection

What the edge must do

Every request from every customer passes through the edge, so it carries the platform's defaults: protection, routing, limits and observability, before traffic reaches any cell.

The school has one front gate with a guard. The guard checks visitors, turns away troublemakers, sends each visitor to the right building, and makes sure no single visitor queues forever while others wait. The side doors stay locked, so nobody can skip the guard.

users ─► anycast edge (nearest PoP) ─► WAF, DDoS, bot rules, TLS
            │ tenant → cell lookup (cached map)
            ▼
         regional entry ─► cell gateway (TLS again) ─► mesh mTLS ─► services
         origin protection: cells accept only edge traffic

Layer by layer

  • Anycast edge network (a CDN or cloud edge service): one IP announced from many locations; users connect to the nearest point of presence; large DDoS attacks are absorbed there.
  • WAF and bot protection: managed rule sets (OWASP top risks), custom rules, rate rules by IP or path, challenge pages for suspicious traffic.
  • TLS: public certificates at the edge (modern protocols only), then re-encryption to the cell; mTLS or private connectivity between edge and origin.
  • Tenant routing: the edge or a regional router finds the tenant's cell from a cached map (lesson 3).
  • Cell gateway (Gateway API implementation): token validation, per-tenant limits, header normalisation (strip client-supplied identity headers), request size limits, timeouts.
  • Trace context: the edge starts (or accepts) a W3C traceparent header, so one trace covers edge → gateway → services.

Per-tenant rate limiting that actually works

Limits protect cells from one tenant starving the others:

  • Key by tenant (from the token or the subdomain), with tiers (free, standard, enterprise) and separate limits for expensive endpoints.
  • Count globally: each gateway replica counting on its own multiplies the limit by the number of replicas. Use a shared rate-limit service (for example Envoy's rate limit service backed by Redis), or local limits sized as limit ÷ replicas plus a global backstop.
  • Respond well: HTTP 429 with Retry-After; publish the limits so customers can design for them.
  • Watch it: dashboards of throttled requests per tenant; frequent throttling is either abuse or a customer who needs a bigger tier.

Origin protection

The edge's protection is worthless if attackers can reach a cell directly. Cells should accept traffic only from the edge: private connectivity where available, otherwise mTLS between edge and origin or signed headers checked by the gateway, plus network rules blocking direct internet access to cell load balancers.

Losing a region

  • Cells live in regions; a region outage takes down its cells.
  • For tenants with a multi-region requirement, keep a standby cell in another region with replicated data, and fail over by changing their map entry (with the data's replication lag in mind).
  • Data residency limits where a tenant may fail over: a tenant bound to one jurisdiction can only fail over within it.
  • Practise failover per cell with game days; measure recovery time and data loss against each tenant tier's targets.

Try it

On a kind cluster with a Gateway API implementation (for example the Gateway API demo from the Kubernetes Security track), add a per-client rate limit using your implementation's rate-limit policy, keyed on a header such as x-tenant-id. Send traffic for two tenants with hey or a loop of curl, and show that only the noisy tenant gets HTTP 429.

Recap

  • The edge carries defaults for every tenant: anycast and DDoS protection, WAF, TLS, tenant routing, trace context.
  • Per-tenant limits must count globally across replicas and answer with 429 and Retry-After.
  • Protect origins so the edge can't be bypassed; plan regional failover within residency rules.

This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.