solana-validator-optimizer
A production-grade Rust toolkit to enhance Solana validator performance by reducing sync latency and improving RPC responsiveness.
Overview
solana-validator-optimizer is a modular enhancement suite for Solana validator infrastructure. It helps operators by:
- Prefetching ledger snapshots from trusted mirrors
- Validating snapshot integrity via SHA-256
- Auto-tuning validator configuration based on hardware resources
- Adding an in-memory LRU cache for frequently used RPC calls
- Exposing Prometheus metrics via a
/metricsendpoint
Compatibility
This project targets the Solana / Agave v3 validator era.
- Solana crate line: 3.0.x
- Recommended validator line: v3.0.14 (Mainnet-Beta recommended)
- Tested against:
- Mainnet RPC: https://api.mainnet-beta.solana.com
- solana-test-validator (local)
Ideal For
- Solana Validator Operators
- RPC Infrastructure Maintainers
- Performance-Focused Mainnet/Devnet Deployments
Core Features
| Feature | Description |
|---|---|
| Snapshot Prefetching | Downloads or copies snapshots locally with optional SHA-256 validation |
| RPC LRU Cache | Reduces redundant RPC calls like getBalance, getEpochInfo, etc. |
| Prometheus Metrics | /metrics endpoint for cache hits, misses, request counts, and latency |
| Config Auto-Tuner | Adjusts validator configuration based on CPU, RAM, disk, and network |
Architecture

Getting Started
1. Clone the Repository
2. Configuration
Create a Config.toml file in the project root:
# Config.toml
# Snapshot settings
= "" # e.g. "https://snapshots.myvalidator.com/latest.tar.zst"
= "" # optional SHA-256 checksum for validation
# RPC and Metrics
= "https://api.mainnet-beta.solana.com"
= 9090 # Prometheus scrapes at http://<host>:9090/metrics
# Cache settings
= 128 # Number of entries in the RPC LRU cache
Usage – CLI Mode
Run all modules (snapshot, RPC cache, auto-tuner, metrics):
Usage – As a Library
Add this to your Cargo.toml:
[]
= "1.2"
= { = "1", = ["full"] }
= "1"
Example usage:
use ;
async
Environment Variables
Any Config.toml value can be overridden using the OPTIMIZER_ prefix.
| Config Key | Environment Variable |
|---|---|
| snapshot_url | OPTIMIZER_SNAPSHOT_URL |
| snapshot_sha256 | OPTIMIZER_SNAPSHOT_SHA256 |
| rpc_url | OPTIMIZER_RPC_URL |
| metrics_port | OPTIMIZER_METRICS_PORT |
| cache_size | OPTIMIZER_CACHE_SIZE |
Example:
OPTIMIZER_RPC_URL=https://api.mainnet-beta.solana.com \
OPTIMIZER_CACHE_SIZE=256 \
Operational Metrics
Prometheus endpoint:
Exposed Metrics
rpc_requests_totalrpc_cache_hits_totalrpc_cache_misses_total
Metrics
Enable Prometheus metrics endpoint:
|
Contributing
Contributions are welcome!
Feel free to open issues, feature requests, or pull requests.
License
Licensed under the MIT License.