Our stock lookup service answers in about twelve milliseconds at the ninety ninth percentile, and the shop calls it with a timeout of two hundred and fifty. It runs as eight pods behind an Application Load Balancer that sends traffic straight to the pods. For a year, every deploy produced a small burst of timeouts in the shop: a few hundred failed lookups, products shown as unavailable for a minute, then nothing. We had filed it under deploys being a bit noisy.
In October we started deploying several times a day, and the bursts became a visible share of the shop's errors, so I looked properly. Every timeout came from a new pod, in its first forty to sixty seconds.
A JVM starts by interpreting bytecode. Methods that run often get compiled, quickly by the C1 compiler first and later, after many more invocations, into optimised code by C2. Until the hot paths are compiled, a request costs many times what it will cost a minute later, and class loading and the first database connections add to it.…