Add --no-os-memory-stats-reporting
This commit is contained in:
parent
dbc62f2e28
commit
2da4e3eb6c
|
@ -117,12 +117,16 @@ pub fn verify_udp_stats_access() -> Result<(), String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SystemMonitorService {
|
impl SystemMonitorService {
|
||||||
pub fn new(exit: Arc<AtomicBool>, report_os_network_stats: bool) -> Self {
|
pub fn new(
|
||||||
|
exit: Arc<AtomicBool>,
|
||||||
|
report_os_memory_stats: bool,
|
||||||
|
report_os_network_stats: bool,
|
||||||
|
) -> Self {
|
||||||
info!("Starting SystemMonitorService");
|
info!("Starting SystemMonitorService");
|
||||||
let thread_hdl = Builder::new()
|
let thread_hdl = Builder::new()
|
||||||
.name("system-monitor".to_string())
|
.name("system-monitor".to_string())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
Self::run(exit, report_os_network_stats);
|
Self::run(exit, report_os_memory_stats, report_os_network_stats);
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -331,7 +335,7 @@ impl SystemMonitorService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(exit: Arc<AtomicBool>, report_os_network_stats: bool) {
|
pub fn run(exit: Arc<AtomicBool>, report_os_memory_stats: bool, report_os_network_stats: bool) {
|
||||||
let mut udp_stats = None;
|
let mut udp_stats = None;
|
||||||
let network_limits_timer = AtomicInterval::default();
|
let network_limits_timer = AtomicInterval::default();
|
||||||
let udp_timer = AtomicInterval::default();
|
let udp_timer = AtomicInterval::default();
|
||||||
|
@ -349,7 +353,7 @@ impl SystemMonitorService {
|
||||||
Self::process_udp_stats(&mut udp_stats);
|
Self::process_udp_stats(&mut udp_stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if mem_timer.should_update(SAMPLE_INTERVAL_MEM_MS) {
|
if report_os_memory_stats && mem_timer.should_update(SAMPLE_INTERVAL_MEM_MS) {
|
||||||
Self::report_mem_stats();
|
Self::report_mem_stats();
|
||||||
}
|
}
|
||||||
sleep(SLEEP_INTERVAL);
|
sleep(SLEEP_INTERVAL);
|
||||||
|
|
|
@ -150,6 +150,7 @@ pub struct ValidatorConfig {
|
||||||
pub bpf_jit: bool,
|
pub bpf_jit: bool,
|
||||||
pub send_transaction_service_config: send_transaction_service::Config,
|
pub send_transaction_service_config: send_transaction_service::Config,
|
||||||
pub no_poh_speed_test: bool,
|
pub no_poh_speed_test: bool,
|
||||||
|
pub no_os_memory_stats_reporting: bool,
|
||||||
pub no_os_network_stats_reporting: bool,
|
pub no_os_network_stats_reporting: bool,
|
||||||
pub poh_pinned_cpu_core: usize,
|
pub poh_pinned_cpu_core: usize,
|
||||||
pub poh_hashes_per_batch: u64,
|
pub poh_hashes_per_batch: u64,
|
||||||
|
@ -211,6 +212,7 @@ impl Default for ValidatorConfig {
|
||||||
bpf_jit: false,
|
bpf_jit: false,
|
||||||
send_transaction_service_config: send_transaction_service::Config::default(),
|
send_transaction_service_config: send_transaction_service::Config::default(),
|
||||||
no_poh_speed_test: true,
|
no_poh_speed_test: true,
|
||||||
|
no_os_memory_stats_reporting: true,
|
||||||
no_os_network_stats_reporting: true,
|
no_os_network_stats_reporting: true,
|
||||||
poh_pinned_cpu_core: poh_service::DEFAULT_PINNED_CPU_CORE,
|
poh_pinned_cpu_core: poh_service::DEFAULT_PINNED_CPU_CORE,
|
||||||
poh_hashes_per_batch: poh_service::DEFAULT_HASHES_PER_BATCH,
|
poh_hashes_per_batch: poh_service::DEFAULT_HASHES_PER_BATCH,
|
||||||
|
@ -443,6 +445,7 @@ impl Validator {
|
||||||
|
|
||||||
let system_monitor_service = Some(SystemMonitorService::new(
|
let system_monitor_service = Some(SystemMonitorService::new(
|
||||||
Arc::clone(&exit),
|
Arc::clone(&exit),
|
||||||
|
!config.no_os_memory_stats_reporting,
|
||||||
!config.no_os_network_stats_reporting,
|
!config.no_os_network_stats_reporting,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -1999,7 +1999,7 @@ fn main() {
|
||||||
|
|
||||||
let exit_signal = Arc::new(AtomicBool::new(false));
|
let exit_signal = Arc::new(AtomicBool::new(false));
|
||||||
let system_monitor_service =
|
let system_monitor_service =
|
||||||
SystemMonitorService::new(Arc::clone(&exit_signal), false);
|
SystemMonitorService::new(Arc::clone(&exit_signal), true, false);
|
||||||
|
|
||||||
if let Some(limit) =
|
if let Some(limit) =
|
||||||
value_t!(arg_matches, "accounts_index_memory_limit_mb", usize).ok()
|
value_t!(arg_matches, "accounts_index_memory_limit_mb", usize).ok()
|
||||||
|
|
|
@ -47,6 +47,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
|
||||||
bpf_jit: config.bpf_jit,
|
bpf_jit: config.bpf_jit,
|
||||||
send_transaction_service_config: config.send_transaction_service_config.clone(),
|
send_transaction_service_config: config.send_transaction_service_config.clone(),
|
||||||
no_poh_speed_test: config.no_poh_speed_test,
|
no_poh_speed_test: config.no_poh_speed_test,
|
||||||
|
no_os_memory_stats_reporting: config.no_os_memory_stats_reporting,
|
||||||
no_os_network_stats_reporting: config.no_os_network_stats_reporting,
|
no_os_network_stats_reporting: config.no_os_network_stats_reporting,
|
||||||
poh_pinned_cpu_core: config.poh_pinned_cpu_core,
|
poh_pinned_cpu_core: config.poh_pinned_cpu_core,
|
||||||
account_indexes: config.account_indexes.clone(),
|
account_indexes: config.account_indexes.clone(),
|
||||||
|
|
|
@ -925,6 +925,11 @@ pub fn main() {
|
||||||
.long("no-os-network-limits-test")
|
.long("no-os-network-limits-test")
|
||||||
.help("Skip checks for OS network limits.")
|
.help("Skip checks for OS network limits.")
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("no_os_memory_stats_reporting")
|
||||||
|
.long("no-os-memory-stats-reporting")
|
||||||
|
.help("Disable reporting of OS memory statistics.")
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("no_os_network_stats_reporting")
|
Arg::with_name("no_os_network_stats_reporting")
|
||||||
.long("no-os-network-stats-reporting")
|
.long("no-os-network-stats-reporting")
|
||||||
|
@ -2362,6 +2367,7 @@ pub fn main() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
no_poh_speed_test: matches.is_present("no_poh_speed_test"),
|
no_poh_speed_test: matches.is_present("no_poh_speed_test"),
|
||||||
|
no_os_memory_stats_reporting: matches.is_present("no_os_memory_stats_reporting"),
|
||||||
no_os_network_stats_reporting: matches.is_present("no_os_network_stats_reporting"),
|
no_os_network_stats_reporting: matches.is_present("no_os_network_stats_reporting"),
|
||||||
poh_pinned_cpu_core: value_of(&matches, "poh_pinned_cpu_core")
|
poh_pinned_cpu_core: value_of(&matches, "poh_pinned_cpu_core")
|
||||||
.unwrap_or(poh_service::DEFAULT_PINNED_CPU_CORE),
|
.unwrap_or(poh_service::DEFAULT_PINNED_CPU_CORE),
|
||||||
|
|
Loading…
Reference in New Issue