The Two Watches: On the Constant Clock and the Forgotten Sundial
There are two kinds of timekeepers in our world of small services. One you wear on your wrist, a precise instrument of quartz and circuitry, ticking away the seconds with relentless, unblinking accuracy. The other is a sundial in a forgotten garden, a stone slate that tells the hour only when the sun deigns to shine upon it. In our infrastructure, these two philosophies manifest as the constant poll and the event-driven trigger, and the choice between them defines the very breath of our systems.
The constant poll is the wristwatch. It’s the cron job that runs every five minutes, the health check that pings an endpoint every thirty seconds, the script that scans a directory for changes on a fixed loop. It is predictable, simple to reason about, and utterly dependable. We set its rhythm and it obeys, a metronome keeping time for our digital orchestra. Its greatest strength is its constancy; it doesn't need to understand the system, only to ask, again and again, "Is it time?" This is the logic of the heartbeat, a steady drum in the chest of the machine.
The Silent Signal
But that constancy comes at a cost. Every tick is a question, and every question consumes a sliver of attention, a fraction of a CPU cycle, a momentary lock on a log file. Multiply this across hundreds of services and thousands of checks, and the hum of all those wristwatches becomes a low-grade fever in the system—always present, always consuming, even when there is nothing new to report. It is the energy of a guard who paces the same route regardless of whether the castle is under siege or deep in peaceful slumber.
The event-driven trigger is the sundial. It does not ask; it listens. It is the inotify wait that only stirs when a file is closed, the webhook that fires only after a deployment succeeds, the message on a queue that exists only when there is work to be done. It is patient, efficient, and silent. It conserves its energy for the moment it is truly needed, acting only when the sun—the event—casts its defining shadow. Its logic is not that of a heartbeat, but of a nerve, firing only when touched.
Yet, the sundial has its own fragility. It requires a clear sky; its mechanism depends entirely on the reliability of the event source. A cloud—a dropped message, a failed callback, a misconfigured listener—and time simply stops. The system holds its breath, waiting for a signal that may never come. The wristwatch, in its oblivious ticking, would have noticed the stall long ago.
The art, then, is not in choosing one over the other, but in knowing which timepiece to consult for which task. Let the wristwatch guard the core vitals, the non-negotiable truths that must always be known. But for the ambient tasks—the log rotation, the cache warming, the notification of a completed job—have the courage to install a sundial. Build a garden for it, tend to its event source, and trust it to speak only when it has something meaningful to say. In that silence between events, you might just hear your systems resting.
Notes & further reading
A few pages I came back to while writing this: