Activator readiness poll: 150ms sleep rounds every wake up Feature Request open
The activator's readiness check sleeps 150ms between probes, so every wake is rounded up to the next 150ms boundary. On titogo instances that is the single largest slice of the wake we cannot attribute to the app.
Measured on carlos-tito-ie today (from the platform's own instance woke in <total> (spawn <Start>) events):
| titogo build | woke in | spawn | |---|---|---| | before app-side fixes | 1.43–1.60s | 1.375s or 1.53s | | after app-side fixes | 377–405ms | 322–335ms |
The spawn figures cluster on multiples of 150ms with a small remainder, which is the poll interval showing through rather than anything the app does: the app binds its socket somewhere inside an interval and the platform notices at the end of it. titogo's own exec-to-listening is ~200ms on that box now, so roughly 100–130ms of a 330ms spawn is the activator waiting.
internal/activator/backend_exec.go (origin/main c1d40eeb when read, around :1348–1366):
resp, err := client.Get("http://carlos/") ... time.Sleep(150 * time.Millisecond)
Two asks, both small:
- Poll far more often. 5–10ms fixed, or a short backoff (say 2ms doubling to 50ms). A unix-socket connect that fails is microseconds, so the cost of frequent polling is nil compared with a 150ms wait. This alone should take ~100ms off a typical titogo wake.
- Consider dialling the socket rather than fetching
/. The probe currently requests the app's real root, which for titogo renders the account's home page (~25–35ms of the spawn on our box, and it grows with the page). "The socket accepts a connection" is the thing being asked; a home page render is a side effect. If a real HTTP response is wanted, an app-declared health path would separate the two.
Happy to be wrong about the second one if the HTTP round trip is deliberately proving more than the socket (a bound-but-broken app, say). The first is the one that matters.
Context, if useful: titogo's own startup was ~600ms of the old 1.5s wake and is now ~200ms on the box (teamtito/titogo#2600, #2601, #2608), which is what makes the platform's share the visible part.