Expand description
The server readiness report: the operating-system settings that decide whether a server performs and stays up under load, each with the reason and the fix, the way enterprise databases warn at start-up.
Read-only: sys-lib reports and never changes a setting; Check::fix
tells the operator what to run. Each check runs only where it applies (on
that OS, for that Profile); elsewhere it is left out, not reported as
passing. A value sys-lib cannot read is Status::Unknown with the reason
in Check::found, never a guess. Every threshold is a documented
constant in this module.
use sys_lib::readiness::{self, Profile};
let report = readiness::report_for(Profile::Database, std::env::temp_dir());
println!("{report}");
for c in report.warnings() {
eprintln!("{}: {} (found {}, want {}): {}", c.id, c.title, c.found, c.recommended, c.fix);
}
if !report.passed() {
// refuse to start, or log loudly
}Structs§
- Check
- One setting, what it is, and what it should be.
- Report
- Every check that applies here, for one profile.
Enums§
- Profile
- What the server is for, which decides the checks and their thresholds.
- Status
- The outcome of one check.
Constants§
- BACKLOG_
MIN - The least listen backlog a database or network server wants.
- DIRTY_
BACKGROUND_ MAX - The most
dirty_background_ratioa database wants, in percent. - DIRTY_
MAX - The most
dirty_ratioa database wants, in percent. - FREE_
FAIL - The free space under which a data directory fails, in percent.
- FREE_
WARN - The free space under which a data directory warns, in percent.
- MAX_
MAP_ COUNT_ MIN - The least
vm.max_map_counta database wants (memory-mapped storage). - OPEN_
FILES_ FLOOR - Below this soft limit a database or network server fails under load.
- OPEN_
FILES_ GENERAL - The open-file soft limit any service wants.
- OPEN_
FILES_ SERVER - The open-file soft limit a database or network server wants.
- PORTS_
MIN - The least ephemeral ports a database or network server wants.
- SWAPPINESS_
MAX - The most
vm.swappinessa database wants. - SWAPPINESS_
MIN - The least
vm.swappinessa database wants.
Functions§
- report
- The report for
profile, read now. Never fails: a value that cannot be read is a check withStatus::Unknown. Costs 0.2 to 2 ms [est.]. - report_
for report, plus the checks of the directory the server keeps its data in: its filesystem, mount options, free space, kind of storage, and I/O scheduler.