How solstackapp/geyserbench works
Main Components
• Config Loader: This part of the system is responsible for creating and reading the default “config.toml” file that holds your benchmarking parameters (number of transactions, account address, commitment level, and gRPC endpoint configurations).
• Benchmarking Core: This module manages the load generation (i.e., sending requests), collects responses, and measures performance (first detection rate, average delay, median, 95th percentile, etc.).
• Metrics Aggregator & Analyzer: After gathering raw data from each endpoint, this component computes the detailed statistics and prepares both simple summary and extended reports.
• Output Formatter: It presents the results to the user via the terminal, generating both quick summaries and detailed breakdowns.
Component Interactions
• The system starts by loading configurations from the “config.toml” file.
• The Config Loader passes endpoint and benchmarking parameters to the gRPC Client Manager.
• The gRPC Client Manager concurrently initiates connections with all endpoints.
• Query or transaction generation is managed by the Benchmarking Core, which sends out the benchmarking workload across endpoints.
• Streaming and asynchronous responses from endpoints are collected, and data is forwarded for processing to the Metrics Aggregator.
• Finally, the output is formatted by the Output Formatter and displayed on the command line.
Architectural Patterns & Design Principles
• Concurrency/Parallelism: Since multiple endpoints are benchmarked concurrently, be sure to illustrate asynchronous execution (e.g., using Rust’s async runtime like Tokio if applicable).
• Data Flow: Emphasize directional data flow from configuration input to network requests, asynchronous response collection, and finally metrics computation leading to user output.
• Error Handling & Logging (implicit): You might also note that certain parts of the code (likely within the gRPC Client Manager and Benchmarking Core) handle errors in networking or malformed responses.
Technologies & Frameworks
• Rust as the primary language (as indicated by Cargo.toml and src/main.rs).
• gRPC for communication with the Solana endpoints.
• An asynchronous runtime (like Tokio) if used for concurrently managing network requests.
• Libraries for metrics aggregation and possibly serialization/deserialization for configuration (e.g., using toml crate).