Overview
The Sol RPC Router supports hot configuration reloading via theSIGHUP signal. This allows you to update backend configurations, routing rules, and health check settings without restarting the server or dropping active connections.
How It Works
The router registers a SIGHUP signal handler on startup that:- Receives the SIGHUP signal
- Reloads the configuration file from disk
- Validates the new configuration
- Preserves health status for existing backends
- Atomically swaps the router state
- Continues serving requests without interruption
Implementation Details
Fromsrc/main.rs:127-191:
Triggering a Reload
Find the Process ID
Send SIGHUP Signal
What Can Be Reloaded
The following configuration changes take effect immediately:Backend Configuration
- Add new backends: Automatically start with healthy status
- Remove backends: Gracefully excluded from routing
- Update backend URLs: New requests use updated endpoints
- Change backend weights: Load balancing adjusts immediately
- Modify WebSocket URLs: New WS connections use updated URLs
Routing Rules
- Method routes: Update which backends handle specific RPC methods
- Add/remove method overrides: Route changes apply to new requests
Health Check Configuration
- Interval: Change health check frequency
- Timeout: Adjust health check timeout
- Method: Switch health check RPC method
- Thresholds: Update failure/success thresholds
- Slot lag: Modify maximum allowed slot lag
Proxy Settings
- Timeout: Update upstream request timeout
What Cannot Be Reloaded
These settings require a full restart:- Server ports (HTTP, WebSocket, Metrics)
- Redis URL
- Prometheus histogram buckets
Health Status Preservation
The reload mechanism preserves backend health state across configuration changes:Existing Backends
If a backend’s label exists in both old and new configurations:- Health status preserved: Unhealthy backends remain unhealthy
- Consecutive counters preserved: Failure/success counts maintained
- Last error preserved: Error messages retained
New Backends
Backends added during reload:- Start with healthy status (optimistic)
- Begin health checks immediately
- Follow normal failure threshold logic
Removed Backends
Backends removed from configuration:- Health status retained in memory (for potential re-addition)
- Immediately excluded from routing
- Stop receiving health checks
Log Output
Successful Reload
Failed Reload
If the new configuration is invalid, the old configuration remains active:- Invalid TOML syntax
- Missing required fields
- Invalid backend weights (must be > 0)
- Method routes referencing non-existent backends
- Empty Redis URL
Active Connection Behavior
HTTP Requests
- In-flight requests: Complete with old backend selection
- New requests: Use new configuration immediately after swap
WebSocket Connections
- Active connections: Remain open to original backend
- New connections: Use newly configured backends
Best Practices
1. Validate Configuration Before Reload
2. Monitor Reload Success
Watch logs when reloading:3. Incremental Changes
Make one type of change at a time:- Add backends first, then adjust weights
- Update method routes separately from health check settings
- Test each change before combining
4. Backup Configuration
Before making changes:5. Use Version Control
Track configuration changes with git:Automation Examples
Systemd Reload
Enable reload support in systemd service:Kubernetes ConfigMap
Automate reloads when ConfigMap changes:Configuration Management
Ansible playbook example:Troubleshooting
Reload Not Taking Effect
Symptom: Configuration changes don’t apply after SIGHUP Solutions:- Check logs for validation errors
- Verify correct config file path
- Ensure process has permission to read config file
- Confirm signal reached the process:
kill -0 <pid>
Old Backends Still Receiving Traffic
Symptom: Removed backends continue getting requests Cause: Active WebSocket connections to old backends Solution: Wait for connections to naturally close, or restart if immediate change neededHealth Status Lost
Symptom: Previously unhealthy backend becomes healthy after reload Cause: Backend label changed (treated as new backend) Solution: Keep backend labels consistent across reloadsNext Steps
- Monitor reload success with Prometheus metrics
- Troubleshoot configuration issues