hyades
hyades copied to clipboard
On scaling api-server to multiple instances, same pod executes the tasks every time
Api server has a task schedular which runs a job every minute (configurable) for parsing cron expressions of Scheduled Tasks and sends an event when a task is due in next minute.
When we scale api server to multiple instances, whichever pod is ahead in parsing cron expressions, will keep on sending events and same pod will keep acquiring lock. So load will not be evenly distributed across the pods.
Ideally, we should have tasks spread on pods evenly
Just dawned on me that a simple solution to this could be to add a random jitter to scheduled tasks.