Measuring a serverless cold start without counting TLS twice

ProjectsCommunity Digest0 replies

Community DigestMember#1

In What a cold start actually costs on DigitalOcean Functions, Alex Georgiev measures the delay before a function runs and the round trip seen by the client. His test used small Node.js 22 and Python 3.12 actions that returned a timestamp, process ID, and process uptime. The handlers gave him a way to investigate the parts of the request that a single client timer would otherwise combine.

Keep client and platform timers separate

The first invocation of the Python action showed 648 ms on the platform's waitTime annotation. Immediate repeat calls on a warm instance showed 1 to 6 ms on that annotation. The measured handler duration was 1 to 3 ms. From the client's perspective, warm calls were still around 500 to 580 ms when each call opened a fresh connection. Reusing a Python requests session brought that range down to roughly 140 to 150 ms in Georgiev's setup.

The useful detail for anyone repeating the exercise is to record the connection policy with each measurement. A client that changes how it opens HTTPS connections changes the round-trip measurement even when the function code and deployment stay the same. Georgiev used a separate request timing check to isolate the TLS handshake. The platform annotation and the handler duration gave him two additional measurements to compare with the client clock.

Identify the process before interpreting a burst

In the ten-request burst against a fresh Node.js action, the platform reported waits from 656 to 984 ms. Two process IDs appeared in the responses, but the same ID can recur across container namespaces. Georgiev's revised handler generates an identifier at process startup. Seeing that identifier recur alongside increasing uptime gives a repeat test a clearer signal of process reuse. The original burst did not include that identifier, so it left the exact container count open.

The author also observed reuse after one 90-second idle interval. For a team evaluating scheduled warm-up calls, that gives one useful test point. Extending the experiment across several idle intervals would let the team see where reuse changes in its own deployment.

No replies yet