News for hackers. Stuff that matters.
Re:What One-person SaaS Healthchecks.io uses for hosting, ha... by rdoherty on Tuesday May 24, 2022 @01:22PM (#31494950)
This is fascinating. I am curious how sites like this (and others such as Pingdom, 'up time' checkers, etc) handle scheduled tasks that have to run at high frequencies? Cron on one machine? Celery beat?
Re:What One-person SaaS Healthchecks.io uses for hosting, ha... by adrienjarthon on Wednesday May 25, 2022 @04:24AM (#31501878)
In my case (updown.io), I use a "scheduler" process (one per machine) which runs the following loop: every 5 seconds it fetches the checks that needs to execute in the next 5 seconds, ordered by time of run ascending. Then it iterates through them one by one, wait with a small sleep until the precise running time, and then push the job into a background job queue (sidekiq / redis in my case). This allows for a very precise timing of execution even if there is hundreds jobs per seconds, and a good distribution over time (instead of firing 100 jobs every seconds in spikes, it can schedule one every 10ms for example)
Re:What One-person SaaS Healthchecks.io uses for hosting, ha... by cuu508 on Tuesday May 24, 2022 @01:32PM (#31495061)
Healthchecks runs a loop of

10 send any due notifications

20 SLEEP 2

30 GOTO 10

The actual loop [1] is of course a little more complicated, and is being run concurrently on several machines.

[1] https://github.com/healthchecks/healthchecks/blob/09a99d3e9c...