1:1 mentoring with Big Tech AI engineers
System Design

Service and Container

Make a pod honest: readiness that means ready now, one trace id per request, a drain that waits for long runs with a derived grace period, and an image you can promote by digest.

Last updated

Production12 min readBuilds onDeploy Your First Agent
What you’ll learn
  • Derive a grace period from a run's p99 and the preStop time, and say what it kills
  • Write liveness and readiness probes that fail for the right reasons
  • Build a digest-pinned, non-root image from a hashed lockfile
26

Service and Container

Readiness that means ready now, one trace id per request, a drain that waits for long runs, and one digest-pinned image.

Key idea

A service stays up while you replace it. Readiness tells the truth, the drain waits for the runs it holds, and the image ships pinned by digest. Agent runs can take tens of seconds, so the grace period is derived from the p99.

One request, one trace id, from the edge to the last log line
ClientEdgePodModel call may send its owntraceparentwhich is overwritten sets a W3C traceparent,overwrites the client's ready, so it gets trafficreads the trace id the header carries on200, or 529 overloaded 4bf92f35…4bf92f35…4bf92f35… finally One log line, written in finally model 200model 529 {"trace_id":"4bf92f3577b34da6a3ce929d0e0e4736","status":200} {"trace_id":"4bf92f3577b34da6a3ce929d0e0e4736","status":500,"error":"Overloaded","upstream":529} one line per request, even when it fails The id the edge set is the id in the log line, whether the model call succeeds or not.

Blue is the request, amber the decisions and the model call, purple the state, teal the trace id. Pans sideways on a phone.

Related

More in System Design

Get full access to all 151 sections with code examples, diagrams, and interactive animations.

Unlock Premium