Skip to main content

Module readiness

Module readiness 

Source
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_ratio a database wants, in percent.
DIRTY_MAX
The most dirty_ratio a 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_count a 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.swappiness a database wants.
SWAPPINESS_MIN
The least vm.swappiness a database wants.

Functions§

report
The report for profile, read now. Never fails: a value that cannot be read is a check with Status::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.