Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
integrate with poh_service
Browse files Browse the repository at this point in the history
  • Loading branch information
pgarg66 committed Nov 26, 2019
1 parent f3d597a commit f02931a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ solana-stake-program = { path = "../programs/stake", version = "0.22.0" }
solana-storage-program = { path = "../programs/storage", version = "0.22.0" }
solana-vote-program = { path = "../programs/vote", version = "0.22.0" }
solana-vote-signer = { path = "../vote-signer", version = "0.22.0" }
solana-sys-tuner = { path = "../sys-tuner", version = "0.22.0" }
symlink = "0.1.0"
sys-info = "0.5.8"
tempfile = "3.1.0"
Expand Down
2 changes: 2 additions & 0 deletions core/src/poh_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::poh_recorder::PohRecorder;
use core_affinity;
use solana_sdk::poh_config::PohConfig;
use solana_sys_tuner;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::thread::{self, sleep, Builder, JoinHandle};
Expand Down Expand Up @@ -47,6 +48,7 @@ impl PohService {
if let Some(cores) = core_affinity::get_core_ids() {
core_affinity::set_for_current(cores[0]);
}
solana_sys_tuner::request_system_tuning();
Self::tick_producer(poh_recorder, &poh_exit_);
}
poh_exit_.store(true, Ordering::Relaxed);
Expand Down
2 changes: 2 additions & 0 deletions net/remote/remote-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ cat >> ~/solana/on-reboot <<EOF
# shellcheck source=/dev/null
SUDO_OK=1 source scripts/tune-system.sh
sudo solana-sys-tuner &
(
sudo SOLANA_METRICS_CONFIG="$SOLANA_METRICS_CONFIG" scripts/oom-monitor.sh
) > oom-monitor.log 2>&1 &
Expand Down
11 changes: 7 additions & 4 deletions sys-tuner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Solana Maintainers <[email protected]>"]
edition = "2018"
name = "solana-sys-tuner"
description = "The solana cluster system tuner daemon"
version = "0.1.0"
version = "0.22.0"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
Expand All @@ -13,13 +13,16 @@ publish = true
clap = "2.33.0"
log = "0.4.8"
semver = "0.9.0"
solana-clap-utils = { path = "../clap-utils", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.22.0" }
unix_socket2 = "0.5.4"

[target."cfg(unix)".dependencies]
[target."cfg(target_os = \"linux\")".dependencies]
thread-priority = "0.1.0"

[lib]
crate-type = ["lib"]
name = "solana_sys_tuner"

[[bin]]
name = "solana-sys-tuner"
path = "src/main.rs"
8 changes: 8 additions & 0 deletions sys-tuner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use crate::main::SOLANA_SYS_TUNER_PATH;
use unix_socket::UnixStream;

pub mod main;

pub fn request_system_tuning() {
let _ignore = UnixStream::connect(SOLANA_SYS_TUNER_PATH);
}
5 changes: 4 additions & 1 deletion sys-tuner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub const SOLANA_SYS_TUNER_PATH: &str = "/tmp/solana-sys-tuner";
#[cfg(all(unix, target_os = "linux"))]
pub const SOLANA_SYS_TUNER_PATH: &str = "\0/tmp/solana-sys-tuner";

#[allow(dead_code)]
#[cfg(target_os = "linux")]
fn tune_system() {
use std::process::Command;
Expand All @@ -23,7 +24,7 @@ fn tune_system() {
if let Ok(threads) = from_utf8(&output.stdout) {
let mut threads: Vec<&str> = threads.split('\n').collect();
for t in threads.iter_mut() {
if let Some(_) = t.find("solana-poh-ser") {
if t.find("solana-poh-ser").is_some() {
let pids: Vec<&str> = t.split_whitespace().collect();
let thread_id = pids[1].parse::<u64>().unwrap();
let _ignored = set_thread_priority(
Expand All @@ -38,9 +39,11 @@ fn tune_system() {
}
}

#[allow(dead_code)]
#[cfg(any(not(unix), target_os = "macos"))]
fn tune_system() {}

#[allow(dead_code)]
fn main() {
solana_logger::setup();
let listener = match UnixListener::bind(SOLANA_SYS_TUNER_PATH) {
Expand Down

0 comments on commit f02931a

Please sign in to comment.