perf: add object pooling and enhanced metrics for streaming optimization

- Implement gRPC/shred connection pools for memory efficiency
- Add atomic processing time stats with auto-calibration clock
- Optimize event parsers and protocol handlers
- Refactor metrics system for advanced performance monitoring
This commit is contained in:
ysq
2025-09-02 17:27:27 +08:00
parent 07bb110dc0
commit b71a83bf66
30 changed files with 920 additions and 273 deletions
@@ -223,10 +223,10 @@ impl_unified_event!(RaydiumClmmOpenPositionV2Event,);
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct RaydiumClmmAmmConfigAccountEvent {
pub metadata: EventMetadata,
pub pubkey: String,
pub pubkey: Pubkey,
pub executable: bool,
pub lamports: u64,
pub owner: String,
pub owner: Pubkey,
pub rent_epoch: u64,
pub amm_config: AmmConfig,
}
@@ -236,10 +236,10 @@ impl_unified_event!(RaydiumClmmAmmConfigAccountEvent,);
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct RaydiumClmmPoolStateAccountEvent {
pub metadata: EventMetadata,
pub pubkey: String,
pub pubkey: Pubkey,
pub executable: bool,
pub lamports: u64,
pub owner: String,
pub owner: Pubkey,
pub rent_epoch: u64,
pub pool_state: PoolState,
}
@@ -249,10 +249,10 @@ impl_unified_event!(RaydiumClmmPoolStateAccountEvent,);
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct RaydiumClmmTickArrayStateAccountEvent {
pub metadata: EventMetadata,
pub pubkey: String,
pub pubkey: Pubkey,
pub executable: bool,
pub lamports: u64,
pub owner: String,
pub owner: Pubkey,
pub rent_epoch: u64,
pub tick_array_state: TickArrayState,
}
@@ -47,10 +47,10 @@ pub fn amm_config_parser(
if let Some(amm_config) = amm_config_decode(&account.data[8..AMM_CONFIG_SIZE + 8]) {
Some(Box::new(RaydiumClmmAmmConfigAccountEvent {
metadata,
pubkey: account.pubkey.to_string(),
pubkey: account.pubkey,
executable: account.executable,
lamports: account.lamports,
owner: account.owner.to_string(),
owner: account.owner,
rent_epoch: account.rent_epoch,
amm_config: amm_config,
}))
@@ -135,10 +135,10 @@ pub fn pool_state_parser(
if let Some(pool_state) = pool_state_decode(&account.data[8..POOL_STATE_SIZE + 8]) {
Some(Box::new(RaydiumClmmPoolStateAccountEvent {
metadata,
pubkey: account.pubkey.to_string(),
pubkey: account.pubkey,
executable: account.executable,
lamports: account.lamports,
owner: account.owner.to_string(),
owner: account.owner,
rent_epoch: account.rent_epoch,
pool_state: pool_state,
}))
@@ -218,10 +218,10 @@ pub fn tick_array_state_parser(
{
Some(Box::new(RaydiumClmmTickArrayStateAccountEvent {
metadata,
pubkey: account.pubkey.to_string(),
pubkey: account.pubkey,
executable: account.executable,
lamports: account.lamports,
owner: account.owner.to_string(),
owner: account.owner,
rent_epoch: account.rent_epoch,
tick_array_state: tick_array_state,
}))