Skip to content

Implement Multi-Region Deployment Orchestration with Latency-Based Routing Selection #757

Description

@temma02

Description

All deployments currently target a single Vercel region. Implement a region selection service that picks the optimal Vercel deployment region based on the user's IP geolocation and measured Stellar Horizon endpoint latency for the chosen network.

Requirements and Context

  • Support regions: us-east-1, eu-west-1, ap-southeast-1
  • Select region that minimizes: 0.7 × user_latency + 0.3 × horizon_latency
  • Cache region selection for 5 minutes to avoid re-measurement on every deployment
  • Fallback: if region measurement fails, default to us-east-1

Suggested Execution

Branch: feat/multi-region-deployment-routing

Implement Changes

  • Create region-selector.service.ts in apps/backend/src/services/
  • Add latency measurement by pinging each region's health endpoint
  • Cache results in Supabase with a 5-minute TTL
  • Add unit tests for region selection algorithm with mocked latency values

Test and Commit

Run pnpm test -- region-selector and confirm optimal region is selected for various latency combinations.

Example Commit Message

feat(deployment): add latency-based multi-region routing for deployment orchestration

Co-authored-by: <your-name>

Guidelines

  • Branch off main, keep PRs focused on one issue
  • All new code must include unit or integration tests
  • Ensure pnpm lint and pnpm typecheck pass before review
  • Link this issue in your PR description
  • Request review from at least one maintainer before merging

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions