Add blockstore column to store performance sampling data (#12251)
* Add blockstore column to store performance sampling data * introduce timer and write performance metrics to blockstore * introduce getRecentPerformanceSamples rpc * only run on rpc nodes enabled with transaction history * add unit tests for get_recent_performance_samples * remove RpcResponse from rpc call * refactor to use Instant::now and elapsed for timer * switch to root bank and ensure not negative subraction * Add PerfSamples to purge/compaction * refactor to use Instant::now and elapsed for timer * switch to root bank and ensure not negative subraction * remove duplicate constants Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
@ -16,6 +16,7 @@ use crate::{
|
||||
rpc_pubsub_service::PubSubService,
|
||||
rpc_service::JsonRpcService,
|
||||
rpc_subscriptions::RpcSubscriptions,
|
||||
sample_performance_service::SamplePerformanceService,
|
||||
serve_repair::ServeRepair,
|
||||
serve_repair_service::ServeRepairService,
|
||||
sigverify,
|
||||
@ -169,6 +170,7 @@ pub struct Validator {
|
||||
transaction_status_service: Option<TransactionStatusService>,
|
||||
rewards_recorder_service: Option<RewardsRecorderService>,
|
||||
cache_block_time_service: Option<CacheBlockTimeService>,
|
||||
sample_performance_service: Option<SamplePerformanceService>,
|
||||
gossip_service: GossipService,
|
||||
serve_repair_service: ServeRepairService,
|
||||
completed_data_sets_service: CompletedDataSetsService,
|
||||
@ -279,6 +281,17 @@ impl Validator {
|
||||
let bank = bank_forks.working_bank();
|
||||
let bank_forks = Arc::new(RwLock::new(bank_forks));
|
||||
|
||||
let sample_performance_service =
|
||||
if config.rpc_addrs.is_some() && config.rpc_config.enable_rpc_transaction_history {
|
||||
Some(SamplePerformanceService::new(
|
||||
&bank_forks,
|
||||
&blockstore,
|
||||
&exit,
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
info!("Starting validator with working bank slot {}", bank.slot());
|
||||
{
|
||||
let hard_forks: Vec<_> = bank.hard_forks().read().unwrap().iter().copied().collect();
|
||||
@ -554,6 +567,7 @@ impl Validator {
|
||||
transaction_status_service,
|
||||
rewards_recorder_service,
|
||||
cache_block_time_service,
|
||||
sample_performance_service,
|
||||
snapshot_packager_service,
|
||||
completed_data_sets_service,
|
||||
tpu,
|
||||
@ -622,6 +636,10 @@ impl Validator {
|
||||
cache_block_time_service.join()?;
|
||||
}
|
||||
|
||||
if let Some(sample_performance_service) = self.sample_performance_service {
|
||||
sample_performance_service.join()?;
|
||||
}
|
||||
|
||||
if let Some(s) = self.snapshot_packager_service {
|
||||
s.join()?;
|
||||
}
|
||||
|
Reference in New Issue
Block a user