Krikri::SSHManager::DaemonKey
Perf items 1-3 (formerly
SUGGESTED_PERFORMANCE_IMPROVEMENTS.md item #15, a doc since
deleted) - the persistent
remote executor's controller half. exec/exec_script above pay
a fresh local ssh fork + remote process spawn on EVERY call,
multiplexed over the same ControlMaster TCP session but never
reusing the actual spawned processes. This instead keeps ONE
ssh ... -- <fat-plugin> --daemon Process alive per (host,
user, port) and speaks the length-prefixed protocol
plugin_daemon.cr implements on the remote end directly over that
process's own stdin/stdout pipes - every subsequent call is a
plain write+read on an already-open pipe, no new process on
either side.
Deliberately opt-in (only reached when PluginManager. daemon_enabled? is true) and only used for the SOLO, non-become
remote-dispatch path - see PluginManager.daemon_eligible?'s own
comment for exactly what's excluded and why. Keyed identically to
@@control_path_cache above, same one-fiber-per-host safety
argument executor.cr's own run_task_for_hosts_in_parallel
comment already documents - a given host's daemon connection is
never touched by two fibers at once, so no correlation ID or lock
is needed on top of this Hash.
Perf item 1: keyed on the become_user
too, not just (host, user, port). A daemon is one resident process
running as one fixed user, so become: true tasks cannot share
the unprivileged host connection's daemon - but they can have
their own, spawned as sudo -n -u <become_user> -- <binary> --daemon. A play mixing privileged and unprivileged tasks holds
two resident daemons per host, which is fine. nil in the last
slot is the no-become daemon.