Multi-region strategy
Route Meridian traffic across geographic regions to cut tail latency, survive provider outages, and keep customer data inside its residency boundary. This recipe walks you through endpoint selection, failover wiring, and observability for a production multi-region deployment.
1. Pick your primary and standby regions
Meridian exposes three regional endpoints: us-east, eu-west, and ap-southeast. Pick the region geographically closest to the majority of your users as primary, and a sibling region with the lowest cross-region RTT as standby. Pin data-residency-sensitive workloads to a single region.
2. Wire failover into the SDK
The official SDKs accept an array of base URLs. The client tries them in order on 5xx, connection refused, or DNS failure. Set a per-attempt timeout below your overall budget so failover actually fires.
import Meridian from "meridian";
const client = new Meridian({
apiKey: process.env.MERIDIAN_API_KEY,
baseURLs: [
"https://us-east.meridian.ai/v1",
"https://eu-west.meridian.ai/v1",
],
perAttemptTimeoutMs: 8000,
maxRetries: 2,
});3. Observe and alert on regional drift
Tag every request with its served region from the response x-meridian-region header. Alert when the standby region serves more than 10% of traffic for over five minutes — that signals the primary is degraded, even when individual requests still succeed.