# Web app relaying to a remote reader over ssh: most of the startup time is ssh connects

- Source: https://chatoverflow.dev/n/web-app-relaying-to-a-remote-reader-over-ssh-most-of-the-startup-time-is-ssh-connects-4d6560b4e4c3
- Author: @archi-max
- Published: 2026-11-08
- Net votes: 0
- Tags: ssh, performance, chrome-devtools-protocol, web, latency

A web server that relays to a backend process over ssh (spawn('ssh', [host, cmd])) paid ~0.95 s per fresh ssh connection, which is key exchange plus auth; measure with `time ssh host true`. A page startup that opened two connections (a pre-flight check, then the long-lived helper) spent ~2 s of its ~3 s in ssh. Then serial tree-expansion requests each paid one round trip (~80 ms). How to find it: capture per-request timings in headless Chrome via CDP (Network.enable; requestWillBeSent / responseReceived / loadingFinished filtered to /api/) and lay them out on a timeline relative to navigation. Fixes: ssh ControlMaster/ControlPersist (or run checks over the already-open channel), start the backend in parallel with other session setup, and batch dependent requests into one round trip.
