remove `solana-sys-tuner` binary and all references (#31682)
This commit is contained in:
parent
9b860abfcc
commit
b422ac0368
|
@ -6106,7 +6106,6 @@ dependencies = [
|
|||
"solana-perf",
|
||||
"solana-runtime",
|
||||
"solana-sdk",
|
||||
"solana-sys-tuner",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -6746,21 +6745,6 @@ dependencies = [
|
|||
"x509-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-sys-tuner"
|
||||
version = "1.16.0"
|
||||
dependencies = [
|
||||
"clap 2.33.3",
|
||||
"libc",
|
||||
"log",
|
||||
"nix",
|
||||
"solana-logger",
|
||||
"solana-version",
|
||||
"sysctl",
|
||||
"unix_socket2",
|
||||
"users",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-system-program"
|
||||
version = "1.16.0"
|
||||
|
@ -8085,15 +8069,6 @@ dependencies = [
|
|||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unix_socket2"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b57c6eace16c00eccb98a28e85db3370eab0685bdd5e13831d59e2bcb49a1d8a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "1.0.0"
|
||||
|
@ -8148,16 +8123,6 @@ dependencies = [
|
|||
"percent-encoding 2.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "users"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
version = "0.7.6"
|
||||
|
|
|
@ -91,7 +91,6 @@ members = [
|
|||
"storage-bigtable/build-proto",
|
||||
"storage-proto",
|
||||
"streamer",
|
||||
"sys-tuner",
|
||||
"test-validator",
|
||||
"thin-client",
|
||||
"tokens",
|
||||
|
@ -349,7 +348,6 @@ solana-stake-program = { path = "programs/stake", version = "=1.16.0" }
|
|||
solana-storage-bigtable = { path = "storage-bigtable", version = "=1.16.0" }
|
||||
solana-storage-proto = { path = "storage-proto", version = "=1.16.0" }
|
||||
solana-streamer = { path = "streamer", version = "=1.16.0" }
|
||||
solana-sys-tuner = { path = "sys-tuner", version = "=1.16.0" }
|
||||
solana-system-program = { path = "programs/system", version = "=1.16.0" }
|
||||
solana-test-validator = { path = "test-validator", version = "=1.16.0" }
|
||||
solana-thin-client = { path = "thin-client", version = "=1.16.0" }
|
||||
|
|
|
@ -38,27 +38,10 @@ that CUDA is enabled: `"[<timestamp> solana::validator] CUDA is enabled"`
|
|||
|
||||
### Linux
|
||||
|
||||
#### Automatic
|
||||
|
||||
The solana repo includes a daemon to adjust system settings to optimize performance
|
||||
(namely by increasing the OS UDP buffer and file mapping limits).
|
||||
|
||||
The daemon (`solana-sys-tuner`) is included in the solana binary release. Restart
|
||||
it, _before_ restarting your validator, after each software upgrade to ensure that
|
||||
the latest recommended settings are applied.
|
||||
|
||||
To run it:
|
||||
|
||||
```bash
|
||||
sudo $(command -v solana-sys-tuner) --user $(whoami) > sys-tuner.log 2>&1 &
|
||||
```
|
||||
|
||||
#### Manual
|
||||
|
||||
If you would prefer to manage system settings on your own, you may do so with
|
||||
the following commands.
|
||||
|
||||
##### **Optimize sysctl knobs**
|
||||
#### **Optimize sysctl knobs**
|
||||
|
||||
```bash
|
||||
sudo bash -c "cat >/etc/sysctl.d/21-solana-validator.conf <<EOF
|
||||
|
@ -80,7 +63,7 @@ EOF"
|
|||
sudo sysctl -p /etc/sysctl.d/21-solana-validator.conf
|
||||
```
|
||||
|
||||
##### **Increase systemd and session file limits**
|
||||
#### **Increase systemd and session file limits**
|
||||
|
||||
Add
|
||||
|
||||
|
@ -353,7 +336,6 @@ the following:
|
|||
[Unit]
|
||||
Description=Solana Validator
|
||||
After=network.target
|
||||
Wants=solana-sys-tuner.service
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
|
|
|
@ -107,9 +107,6 @@ cat >> ~/solana/on-reboot <<EOF
|
|||
PATH="$HOME"/.cargo/bin:"$PATH"
|
||||
export USE_INSTALL=1
|
||||
|
||||
sudo RUST_LOG=info ~solana/.cargo/bin/solana-sys-tuner --user $(whoami) > sys-tuner.log 2>&1 &
|
||||
echo \$! > sys-tuner.pid
|
||||
|
||||
(
|
||||
sudo SOLANA_METRICS_CONFIG="$SOLANA_METRICS_CONFIG" scripts/oom-monitor.sh
|
||||
) > oom-monitor.log 2>&1 &
|
||||
|
|
|
@ -19,7 +19,6 @@ solana-measure = { workspace = true }
|
|||
solana-metrics = { workspace = true }
|
||||
solana-runtime = { workspace = true }
|
||||
solana-sdk = { workspace = true }
|
||||
solana-sys-tuner = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -108,7 +108,6 @@ impl PohService {
|
|||
let tick_producer = Builder::new()
|
||||
.name("solPohTickProd".to_string())
|
||||
.spawn(move || {
|
||||
solana_sys_tuner::request_realtime_poh();
|
||||
if poh_config.hashes_per_tick.is_none() {
|
||||
if poh_config.target_tick_count.is_none() {
|
||||
Self::low_power_tick_producer(
|
||||
|
|
|
@ -5068,7 +5068,6 @@ dependencies = [
|
|||
"solana-metrics",
|
||||
"solana-runtime",
|
||||
"solana-sdk",
|
||||
"solana-sys-tuner",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -5978,21 +5977,6 @@ dependencies = [
|
|||
"x509-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-sys-tuner"
|
||||
version = "1.16.0"
|
||||
dependencies = [
|
||||
"clap 2.33.3",
|
||||
"libc",
|
||||
"log",
|
||||
"nix",
|
||||
"solana-logger",
|
||||
"solana-version",
|
||||
"sysctl",
|
||||
"unix_socket2",
|
||||
"users",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-system-program"
|
||||
version = "1.16.0"
|
||||
|
@ -7151,15 +7135,6 @@ dependencies = [
|
|||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unix_socket2"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b57c6eace16c00eccb98a28e85db3370eab0685bdd5e13831d59e2bcb49a1d8a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "1.0.0"
|
||||
|
@ -7214,16 +7189,6 @@ dependencies = [
|
|||
"percent-encoding 2.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "users"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
version = "0.7.5"
|
||||
|
|
|
@ -103,7 +103,6 @@ else
|
|||
solana-ledger-tool
|
||||
solana-log-analyzer
|
||||
solana-net-shaper
|
||||
solana-sys-tuner
|
||||
solana-validator
|
||||
rbpf-cli
|
||||
)
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
[package]
|
||||
name = "solana-sys-tuner"
|
||||
description = "The solana cluster system tuner daemon"
|
||||
documentation = "https://docs.rs/solana-sys-tuner"
|
||||
publish = true
|
||||
version = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
license = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
clap = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true }
|
||||
solana-logger = { workspace = true }
|
||||
solana-version = { workspace = true }
|
||||
|
||||
[target."cfg(unix)".dependencies]
|
||||
unix_socket2 = { workspace = true }
|
||||
users = { workspace = true }
|
||||
nix = { workspace = true }
|
||||
sysctl = { workspace = true }
|
||||
|
||||
[lib]
|
||||
name = "solana_sys_tuner"
|
||||
|
||||
[[bin]]
|
||||
name = "solana-sys-tuner"
|
||||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
|
@ -1,21 +0,0 @@
|
|||
use log::*;
|
||||
|
||||
pub const SOLANA_SYS_TUNER_PATH: &str = "/tmp/solana-sys-tuner";
|
||||
|
||||
#[cfg(unix)]
|
||||
pub fn request_realtime_poh() {
|
||||
info!("Sending tuning request");
|
||||
let status = unix_socket::UnixStream::connect(SOLANA_SYS_TUNER_PATH);
|
||||
match status {
|
||||
Ok(_) => info!("Successfully sent tuning request"),
|
||||
Err(err) => warn!(
|
||||
"Failed to send tuning request, is `solana-sys-tuner` running? {:?}",
|
||||
err
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
pub fn request_realtime_poh() {
|
||||
info!("Tuning request ignored on this platform");
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
#[cfg(not(target_family = "windows"))]
|
||||
use clap::{crate_description, crate_name, value_t_or_exit, App, Arg};
|
||||
use log::*;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[allow(dead_code)]
|
||||
fn tune_poh_service_priority(uid: u32) {
|
||||
fn find_pid<P: AsRef<std::path::Path>, F>(
|
||||
name: &str,
|
||||
path: P,
|
||||
uid: u32,
|
||||
processor: F,
|
||||
) -> Option<u64>
|
||||
where
|
||||
F: Fn(&std::fs::DirEntry) -> Option<u64>,
|
||||
{
|
||||
for entry in std::fs::read_dir(path).expect("Failed to read /proc folder") {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
if let Ok(dir) = entry {
|
||||
if let Ok(meta) = std::fs::metadata(dir.path()) {
|
||||
if uid == meta.uid() {
|
||||
let mut path = dir.path();
|
||||
path.push("comm");
|
||||
if let Ok(comm) = std::fs::read_to_string(path.as_path()) {
|
||||
if comm.starts_with(name) {
|
||||
if let Some(pid) = processor(&dir) {
|
||||
return Some(pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
use std::{process::Command, str::from_utf8};
|
||||
|
||||
if let Some(pid) = find_pid("solana-validato", "/proc", uid, |dir| {
|
||||
let mut path = dir.path();
|
||||
path.push("task");
|
||||
find_pid("solana-poh-serv", path, uid, |dir1| {
|
||||
if let Ok(pid) = dir1.file_name().into_string() {
|
||||
pid.parse::<u64>().ok()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}) {
|
||||
info!("PoH thread PID is {}", pid);
|
||||
let pid = format!("{pid}");
|
||||
let output = Command::new("chrt")
|
||||
.args(["-r", "-p", "99", pid.as_str()])
|
||||
.output()
|
||||
.expect("Expected to set priority of thread");
|
||||
if output.status.success() {
|
||||
info!("Done setting thread priority");
|
||||
} else {
|
||||
error!("chrt stderr: {}", from_utf8(&output.stderr).unwrap_or("?"));
|
||||
}
|
||||
} else {
|
||||
error!("Could not find pid for PoH thread");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn tune_kernel_udp_buffers_and_vmmap() {
|
||||
use sysctl::{CtlValue::String, Sysctl, SysctlError};
|
||||
fn sysctl_increase_to(name: &str, value: i64) {
|
||||
if let Ok(ctl) = sysctl::Ctl::new(name) {
|
||||
if let Ok(old_value) = ctl.value().and_then(|v| {
|
||||
v.to_string()
|
||||
.parse::<i64>()
|
||||
.map_err(|_| SysctlError::ParseError)
|
||||
}) {
|
||||
if old_value < value {
|
||||
info!("Old {} value {}", name, old_value);
|
||||
let ctl_value = String(value.to_string());
|
||||
match ctl.set_value(String(value.to_string())) {
|
||||
Ok(v) if v == ctl_value => info!("Updated {} to {:?}", name, ctl_value),
|
||||
Ok(v) => info!(
|
||||
"Update returned success but {} was set to {:?}, instead of {:?}",
|
||||
name, v, ctl_value
|
||||
),
|
||||
Err(e) => error!("Failed to set {} to {:?}. Err {:?}", name, ctl_value, e),
|
||||
}
|
||||
} else {
|
||||
info!(
|
||||
"Current {} value ({}) >= new value ({}), not changing",
|
||||
name, old_value, value
|
||||
);
|
||||
}
|
||||
} else {
|
||||
error!("Failed to read current value of sysctl {} as i64", name);
|
||||
}
|
||||
} else {
|
||||
error!("Failed to find sysctl {}", name);
|
||||
}
|
||||
}
|
||||
|
||||
// Reference: https://medium.com/@CameronSparr/increase-os-udp-buffers-to-improve-performance-51d167bb1360
|
||||
sysctl_increase_to("net.core.rmem_max", 134217728);
|
||||
sysctl_increase_to("net.core.rmem_default", 134217728);
|
||||
sysctl_increase_to("net.core.wmem_max", 134217728);
|
||||
sysctl_increase_to("net.core.wmem_default", 134217728);
|
||||
|
||||
// increase mmap counts for many append_vecs
|
||||
sysctl_increase_to("vm.max_map_count", 1000000);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn main() {
|
||||
solana_logger::setup();
|
||||
let matches = App::new(crate_name!())
|
||||
.about(crate_description!())
|
||||
.version(solana_version::version!())
|
||||
.arg(
|
||||
Arg::with_name("user")
|
||||
.long("user")
|
||||
.value_name("user name")
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
.help("Username of the peer process"),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let user = value_t_or_exit!(matches, "user", String);
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
tune_kernel_udp_buffers_and_vmmap();
|
||||
|
||||
info!("Tune will service requests only from user {}", user);
|
||||
|
||||
unsafe { libc::umask(0o077) };
|
||||
if let Err(e) = std::fs::remove_file(solana_sys_tuner::SOLANA_SYS_TUNER_PATH) {
|
||||
if e.kind() != std::io::ErrorKind::NotFound {
|
||||
panic!("Failed to remove stale socket file: {e:?}")
|
||||
}
|
||||
}
|
||||
|
||||
let listener = unix_socket::UnixListener::bind(solana_sys_tuner::SOLANA_SYS_TUNER_PATH)
|
||||
.expect("Failed to bind to the socket file");
|
||||
|
||||
let peer_uid;
|
||||
|
||||
// set socket permission
|
||||
if let Some(user) = users::get_user_by_name(&user) {
|
||||
peer_uid = user.uid();
|
||||
info!("UID for solana is {}", peer_uid);
|
||||
nix::unistd::chown(
|
||||
solana_sys_tuner::SOLANA_SYS_TUNER_PATH,
|
||||
Some(nix::unistd::Uid::from_raw(peer_uid)),
|
||||
None,
|
||||
)
|
||||
.expect("Expected to change UID of the socket file");
|
||||
} else {
|
||||
panic!("Could not find UID for {user:?} user");
|
||||
}
|
||||
|
||||
info!("Waiting for tuning requests");
|
||||
for stream in listener.incoming() {
|
||||
if stream.is_ok() {
|
||||
info!("Tuning the system now");
|
||||
{
|
||||
#![cfg(target_os = "linux")]
|
||||
// tune_poh_service_priority(peer_uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info!("exiting");
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
fn main() {
|
||||
error!("Unsupported platform");
|
||||
}
|
Loading…
Reference in New Issue