Goals:
- to move Queue scheduling out of the DB, as it causes operational concerns
- to remove the
queue-scheduler daemon as it's written in rust and we'd like to not have any rust left in our codebase
Evaluation of Google Pub Sub
Pub-sub does not seem to be a direct match for our queues, for a number of reasons:
- only stores items for a week, we store them for longer (we might need to change this, but not necessarily now)
- does not have a concept of "paused" or "blocked"
So this implies that pub-sub is not necessarily great as the backing store. But perhaps it will be ok as a scheduler.
How would it work for scheduling:
So the idea here is that we have the queue do the scheduling instead of a having a queue-scheduler service. This would mean we're not doing queries for "what's next" on the DB, we'd let the queue do that.
enqueue
Save entry in the DB. Send id to the queue.
dequeue
fetch item from the queue. Fetch event and some metadata from the DB for this event ID. (so it's using the DB as a k/v store for the data and metadata)
put back
- Don't put back for missing
- Don't put back for incomplete
- For error fetching the canvas, increment retries. Reject it if retries not high enough, or acknowledge it if we're not going to retry again. Pub/Sub supports retries and delays.
- For error running the canvas, increment retries
- For errors due to shutdown before acknowledgement, it will just run it again later.
Block / pause
- Check the rule when you load the canvas. If it's blocked or paused, acknowledge to remove it from the queue, and don't change the status.
Unblock, unpause:
Fetch the items and put them in the queue. this happens fairly rarely so the fact that we have to search isn't a big deal.
Goals:
queue-schedulerdaemon as it's written in rust and we'd like to not have any rust left in our codebaseEvaluation of Google Pub Sub
Pub-sub does not seem to be a direct match for our queues, for a number of reasons:
So this implies that pub-sub is not necessarily great as the backing store. But perhaps it will be ok as a scheduler.
How would it work for scheduling:
So the idea here is that we have the queue do the scheduling instead of a having a queue-scheduler service. This would mean we're not doing queries for "what's next" on the DB, we'd let the queue do that.
enqueue
Save entry in the DB. Send id to the queue.
dequeue
fetch item from the queue. Fetch event and some metadata from the DB for this event ID. (so it's using the DB as a k/v store for the data and metadata)
put back
Block / pause
Unblock, unpause:
Fetch the items and put them in the queue. this happens fairly rarely so the fact that we have to search isn't a big deal.