A cron job on 500 servers uploads metrics to an API at `0 * * * *`. The API rate-limits and many uploads fail. Fix it.
IntermediateScenarioScenarios: text processing and scheduling decisions
Answer
Situation read → Thundering herd: every host fires at exactly the same second.
What I'd do →
- With systemd timers:
RandomizedDelaySec=15minand, on recent systemd,FixedRandomDelay=trueso each host gets a stable offset. - With cron: a stable per-host delay derived from the hostname:
delay=$(( $(hostname | cksum | cut -d' ' -f1) % 900 )) sleep "$delay" - Add retries with exponential backoff and jitter on HTTP 429.
- Ask whether pull-based collection (Prometheus scraping) fits better than push.
Why → Spreading 500 requests across 15 minutes turns a spike into a trickle.
Interview tip → Mention a stable offset over a random one, so each host's run time is predictable for debugging.
More on Scenarios: text processing and scheduling decisions
Users report errors in the last hour. From the Nginx access log, find which endpoints produce the most 5xx responses.BeginnerA MySQL slow log is 3 GB. You need the 10 slowest query patterns. What do you do?IntermediateTwo servers that should be identical behave differently. Compare their installed packages.BeginnerFind which pods were OOMKilled in a namespace, with their container names and restart counts.IntermediateProduce a CSV of running EC2 instances that are missing an `Owner` tag.IntermediateYou have access logs from five web servers and need one timeline sorted by time. How?Intermediate