This commit is contained in:
Lou-Kamades 2024-04-02 10:49:39 +02:00
parent dffd66662d
commit 122203d140
No known key found for this signature in database
GPG Key ID: 87A166E4D7C01F30
4 changed files with 33 additions and 24 deletions

1
Cargo.lock generated
View File

@ -2585,6 +2585,7 @@ dependencies = [
"futures-util",
"hyper",
"itertools 0.10.5",
"jemalloc-ctl",
"jemallocator",
"jsonrpsee",
"lazy_static",

View File

@ -50,7 +50,8 @@ cap = { version = "0.1.2", features = ["stats"] }
tower = "0.4.13"
hyper = { version = "0.14", features = ["server", "http1", "http2"] }
tower-http = { version = "0.4.0", features = ["full"] }
jemallocator = { workspace = true }
jemallocator = { workspace = true, features = ["profiling"] }
jemalloc-ctl = "0.5.4"
solana-lite-rpc-core = { workspace = true }
solana-lite-rpc-util = { workspace = true }

View File

@ -76,6 +76,12 @@ use tracing_subscriber::EnvFilter;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
// export _RJEM_MALLOC_CONF=prof:true,lg_prof_interval:30,lg_prof_sample:21,prof_prefix:/tmp/jeprof
use jemalloc_ctl::{epoch, stats};
use std::{thread, time::{self}};
async fn get_latest_block_info(
mut blockinfo_stream: BlockInfoStream,
commitment_config: CommitmentConfig,
@ -395,6 +401,30 @@ pub async fn start_lite_rpc(args: Config, rpc_client: Arc<RpcClient>) -> anyhow:
));
drop(slot_notifier);
// tokio::spawn(async move {
// let last_allocated = stats::allocated::read().unwrap();
// let last_resident = stats::resident::read().unwrap();
// let last_mapped = stats::mapped::read().unwrap();
// let last_active = stats::active::read().unwrap();
// loop {
// thread::sleep(time::Duration::from_secs(10));
// // Retrieve memory statistics
// // let stats = stats::active::mib().unwrap().read().unwrap();
// let allocated = stats::allocated::read().unwrap();
// let resident = stats::resident::read().unwrap();
// let mapped = stats::mapped::read().unwrap();
// let active = stats::active::read().unwrap();
// info!("Current allocated memory: {} bytes -- diff {}", allocated, last_allocated as i64 - allocated as i64);
// info!("Current resident memory: {} bytes -- diff {}", resident, last_resident as i64 - resident as i64);
// info!("Current mapped memory: {} bytes -- diff {}", mapped, last_mapped as i64 - mapped as i64);
// info!("Current active memory: {} bytes -- diff {}\n", active, last_active as i64 - active as i64);
// }
// });
tokio::select! {
res = tx_service_jh => {
anyhow::bail!("Tx Services {res:?}")

View File

@ -11,7 +11,6 @@ use tokio::time::Instant;
use crate::setup::setup_tx_service;
use jemalloc_ctl::{epoch, stats};
mod setup;
@ -27,29 +26,7 @@ pub async fn txn_broadcast() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();
info!("START BENCHMARK: txn_broadcast");
tokio::spawn(async move {
let mut last_allocated = stats::allocated::read().unwrap();
let mut last_resident = stats::resident::read().unwrap();
let mut last_mapped = stats::mapped::read().unwrap();
let mut last_active = stats::active::read().unwrap();
loop {
thread::sleep(time::Duration::from_secs(10));
// Retrieve memory statistics
// let stats = stats::active::mib().unwrap().read().unwrap();
let allocated = stats::allocated::read().unwrap();
let resident = stats::resident::read().unwrap();
let mapped = stats::mapped::read().unwrap();
let active = stats::active::read().unwrap();
info!("Current allocated memory: {} bytes -- diff {}", allocated, last_allocated as i64 - allocated as i64);
info!("Current resident memory: {} bytes -- diff {}", resident, last_resident as i64 - resident as i64);
info!("Current mapped memory: {} bytes -- diff {}", mapped, last_mapped as i64 - mapped as i64);
info!("Current active memory: {} bytes -- diff {}", active, last_active as i64 - active as i64);
}
});
debug!("spawning tx_service");
let (transaction_service, data_cache, _tx_jh) = setup_tx_service().await?;