Scaling Dimensions
Single-Server Scaling
Worker Pool
For CPU-bound workloads, use the worker pool adapter:Pool Sizing Guidelines
Enclave Pooling
Reuse Enclave instances to avoid initialization overhead:Distributed Scaling
Architecture
Broker Configuration
Runtime Configuration
Client Configuration
Redis Configuration
Session State
Redis Cluster
For high availability:Kubernetes Scaling
Horizontal Pod Autoscaler
Pod Disruption Budget
Resource Quotas
Load Balancing
Sticky Sessions
For WebSocket connections:Runtime Routing
Route to specific runtimes based on workload:Performance Benchmarks
Single Server (8 cores, 16GB RAM)
Distributed (3 runtime pods)
Monitoring at Scale
Key Metrics
Alerting Rules
Best Practices
- Start simple - Use worker pool before going distributed
- Monitor queue depth - Scale based on pending executions
- Set memory limits - Prevent runaway scripts
- Use connection pooling - Reuse Redis/DB connections
- Implement backpressure - Reject requests when overloaded
- Regional deployment - Deploy runtimes close to users
- Graceful degradation - Fallback when components fail
Related
- Production Deployment - Deployment guide
- Worker Pool - Worker pool details
- EnclaveJS Broker - Broker configuration