Another tef gem on pipelines

2023-06-29

tef has written another great post about pipelines, and in particular why (and how!) not to use message queues to implement them:

=> how (not) to write a pipeline [tef, cohost]

The tl;dr is that your “background job” is really a state machine. Even the simplest possible job:

def do_something(inputs) -> outputs:
    # do something
    pass

Is a state machine with 4 possible states:

And a simple pipeline based on a message broker almost certainly does not support:

So bite the bullet and implement this using a proper database table (or equivalent) to track the state of each job!

You might still end up with a queue, but as an optimization, not as a load-bearing part of the design:

the queue buffers the results of a more expensive database query

Tags

=> Distributed systems » Pipelines

Proxy Information
Original URL
gemini://dcreager.net/2023/06/29-tef-pipelines.gmi
Status Code
Success (20)
Meta
text/gemini;lang=en
Capsule Response Time
406.718313 milliseconds
Gemini-to-HTML Time
0.748912 milliseconds

This content has been proxied by September (3851b).