Instance lease builds a new S3 client on every wake (55-70ms) Feature Request open
Every wake builds a fresh S3 client before it can acquire the instance lease, so each one pays a credential lookup and a TLS handshake before the app is even started.
internal/lease/lease.go (origin/main c1d40eeb when read, around :119–168), via backend_exec.go:228:
awsconfig.LoadDefaultConfig(...) // lease/endpoint.go:104 — new client per wake ... // then AcquireLease: GET lock.json, conditional PUT
On carlos-tito-ie the gap between the platform's own woke in and spawn figures is a steady 55–70ms, on every wake, whatever the app does. That is this step.
Two asks:
- Build the S3 client once per process and reuse it (and the replica client with it). The credentials and endpoint do not change between wakes, and the connection pool would keep the TLS session warm. I would expect most of the 55–70ms back, since the two S3 calls themselves are same-region and small.
- A question rather than a request: could the lease run concurrently with the spawn when the database file is already on local disk (the warm-cache path where
restoreis a no-opos.Stat)? The lease would still have to be held before the app is allowed to touch the DB, which is what makes this a design question rather than a patch: the app starts writing as soon as it boots, so "acquired before exec" may be the property you want to keep. If it is, say so and we will stop looking at it.
For scale: a titogo wake is ~390ms today, so this step is ~15% of it, and will be a larger share once the readiness poll (discussion #149) is tightened.