Architecture
Deployment Model
Deploy one Lasso node per region and route application traffic to the nearest node:Optional: Cluster Aggregation
Connect nodes via clustering for unified observability:Key Principles
Independent Node Operation
- Each node runs a complete, isolated supervision tree
- Routing decisions based on local latency measurements only
- No cluster consensus or coordination in request hot path
- A single node works standalone without clustering
Regional Latency Awareness
- Passive benchmarking reveals which providers are fastest from each region
- Provider performance varies significantly by geography
- Example: Alchemy may be fastest in US-East but slower in EU-West
- Each node discovers the optimal provider for its region
Observability-First Clustering
- Clustering aggregates metrics for dashboards only
- View cluster as unified whole or drill into regions
- Identify providers struggling in specific regions
- No routing impact: clustering is purely for observability
Configuration
Region-Specific Node IDs
SetLASSO_NODE_ID to match the deployment region:
- Metrics are partitioned by
{provider_id, node_id} - Dashboard groups performance by region
- Circuit breaker states are per-node
- Enables regional comparison in observability
Enable Clustering (Optional)
To aggregate metrics across regions, enable clustering on all nodes:Traffic Routing
Route application traffic to the nearest Lasso node using:GeoDNS
Use geographic DNS routing to direct clients to the nearest node:- AWS Route 53 (geolocation routing)
- Cloudflare (geo-routing)
- Google Cloud DNS (geolocation routing)
- Azure Traffic Manager
Anycast
Announce the same IP from multiple regions, with BGP routing traffic to the nearest location:- Automatic nearest-region routing via BGP
- No DNS-based routing required
- Requires anycast-capable infrastructure (Cloudflare, cloud providers)
Load Balancer Geographic Routing
Use cloud load balancers with geographic routing:- AWS Global Accelerator: Anycast + health checks
- GCP Global Load Balancer: Cross-region load balancing
- Azure Front Door: Global HTTP load balancer
- Cloudflare Load Balancer: Geo-steering
Deployment Examples
Kubernetes Multi-Region
Deploy to each region
eu-west-1 and ap-southeast-1 clusters with region-specific LASSO_NODE_ID and PHX_HOST.Configure cross-region service discovery
For cross-region clustering, use a global DNS service that resolves to all regional cluster IPs:
Docker Swarm Multi-Region
VM/Bare Metal Multi-Region
Configure service discovery
Use Consul, etcd, or cloud DNS to maintain
lasso.internal.example.com resolving to all node IPs.Regional Performance Comparison
The dashboard provides regional drill-down when clustering is enabled:Aggregate View
View performance across all regions:Regional Drill-Down
Compare performance by region:- Alchemy is fastest in US-East
- Higher latency in EU-West and AP-Southeast
- Consider regional provider alternatives (e.g., EU-specific providers)
Circuit Breaker Isolation
Circuit breakers are per-node, providing regional fault isolation: Scenario: Alchemy has an outage in EU-West but is healthy in other regions.- EU-West node fails over to Infura or LlamaRPC
- US-East and AP-Southeast continue using Alchemy
- No cross-region coordination needed
Scaling Patterns
Horizontal Scaling Within Region
Run multiple nodes per region behind a load balancer:- Same
LASSO_NODE_IDfor all nodes in the region - Metrics aggregate at the region level
- Stateless request handling (no sticky sessions needed)
Vertical Scaling
Increase resources per node:- BEAM scheduler cores: Set
--erl "+S 8:8"for 8 schedulers - Memory: Increase container/VM memory for larger metric stores
- Connection pools: Tune Finch pool sizes in
config/runtime.exs
Monitoring and Observability
Health Checks Per Region
Configure health checks in each region’s load balancer:Regional Metrics
Key metrics to monitor per region:- Request rate: Requests/second per region
- Latency: P50, P95, P99 per provider per region
- Circuit breaker state: Open breakers indicate regional issues
- Provider availability: Percentage of healthy providers
- Cluster connectivity: Node states (
:responding,:unresponsive)
Unified Dashboard
When clustering is enabled, access the dashboard from any node to see cluster-wide metrics:Disaster Recovery
Regional Failover
If an entire region goes down:- GeoDNS/Load balancer detects unhealthy region
- Traffic routes to next-nearest region
- Clients reconnect to fallback region
- No manual intervention required
Degraded Mode
If clustering fails but nodes are healthy:- Each node continues routing independently
- Dashboard shows local metrics only
- Applications unaffected (routing unchanged)
- Fix cluster networking to restore aggregation
Best Practices
- Use stable node IDs: Match cloud region codes (
us-east-1, notnode-1) - Deploy at least 3 regions: Provides global coverage and redundancy
- Monitor regional performance: Identify geographic provider issues
- Test cross-region failover: Simulate region outages
- Plan network topology: Ensure low-latency cluster communication
- Use regional provider endpoints: Some providers have regional URLs
Cost Optimization
Provider Selection by Region
Some providers offer better pricing or performance in specific regions:Request Volume Balancing
Distribute traffic based on regional request volumes:- Deploy more nodes in high-traffic regions
- Use cheaper providers in low-traffic regions
- Monitor cost per region in cloud billing
Next Steps
- Clustering - Configure cross-region clustering
- Production Checklist - Pre-launch verification
- Architecture - Understand geo-distributed design