Skip to content

Commit

Permalink
optimize RPC handling and batch processing configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeytimoshin committed Jan 27, 2025
1 parent f9d2c8d commit 282bea6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
9 changes: 3 additions & 6 deletions forester/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub struct StartArgs {
#[arg(long, env = "FORESTER_CU_LIMIT", default_value = "1000000")]
pub cu_limit: u32,

#[arg(long, env = "FORESTER_RPC_POOL_SIZE", default_value = "20")]
#[arg(long, env = "FORESTER_RPC_POOL_SIZE", default_value = "98")]
pub rpc_pool_size: usize,

#[arg(
Expand Down Expand Up @@ -112,11 +112,8 @@ pub struct StartArgs {
)]
pub address_queue_processing_length: u16,

#[arg(long, env = "FORESTER_ENABLE_RPC_RATE_LIMIT", default_value = "false")]
pub rpc_rate_limit_enabled: bool,

#[arg(long, env = "FORESTER_RPC_RATE_LIMIT", default_value = "100")]
pub rpc_rate_limit: u32,
#[arg(long, env = "FORESTER_RPC_RATE_LIMIT")]
pub rpc_rate_limit: Option<u32>,
}

#[derive(Parser, Clone, Debug)]
Expand Down
9 changes: 2 additions & 7 deletions forester/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ impl ForesterConfig {
.clone()
.ok_or(ConfigError::MissingField { field: "rpc_url" })?;

let mut rpc_rate_limit = None;
if args.rpc_rate_limit_enabled {
rpc_rate_limit = Some(args.rpc_rate_limit);
}

Ok(Self {
external_services: ExternalServicesConfig {
rpc_url,
Expand All @@ -157,7 +152,7 @@ impl ForesterConfig {
photon_api_key: args.photon_api_key.clone(),
pushgateway_url: args.push_gateway_url.clone(),
pagerduty_routing_key: args.pagerduty_routing_key.clone(),
rpc_rate_limit,
rpc_rate_limit: args.rpc_rate_limit,
},
retry_config: RetryConfig {
max_retries: args.max_retries,
Expand Down Expand Up @@ -217,7 +212,7 @@ impl ForesterConfig {
indexer_config: IndexerConfig::default(),
transaction_config: TransactionConfig::default(),
general_config: GeneralConfig {
rpc_pool_size: 1,
rpc_pool_size: 10,
slot_update_interval_seconds: 10,
tree_discovery_interval_seconds: 5,
enable_metrics: args.enable_metrics(),
Expand Down
4 changes: 2 additions & 2 deletions forester/src/epoch_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,9 +919,9 @@ impl<R: RpcConnection, I: Indexer<R> + IndexerType<R>> EpochManager<R, I> {
// rate-limiting mechanism (with more control). Or rework
// the send logic to not await confirmations.
let batched_tx_config = SendBatchedTransactionsConfig {
num_batches: 10,
num_batches: 2,
build_transaction_batch_config: BuildTransactionBatchConfig {
batch_size: 50, // TODO: make batch size configurable and or dynamic based on queue usage
batch_size: 60, // TODO: make batch size configurable and or dynamic based on queue usage
compute_unit_price: Some(10_000), // Is dynamic. Sets max.
compute_unit_limit: Some(180_000),
},
Expand Down
4 changes: 0 additions & 4 deletions programs/registry/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ pub fn get_cpi_authority_pda() -> (Pubkey, u8) {
}

pub fn get_forester_epoch_pda_from_authority(authority: &Pubkey, epoch: u64) -> (Pubkey, u8) {
println!(
"get_forester_epoch_pda_from_authority: authority: {}, epoch: {}",
authority, epoch
);
let forester_pda = get_forester_pda(authority);
get_forester_epoch_pda(&forester_pda.0, epoch)
}
Expand Down

0 comments on commit 282bea6

Please sign in to comment.