Readit News logoReadit News
KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
alpb · 16 days ago
As far as I know, Azure Durable Functions doesn't have a server-side proprietary component and it's actually fully open source framework/clients as well. So it's actually not a cloud offering per-se. You can see the full implementations at:

* https://github.com/Azure/durabletask

* https://github.com/microsoft/durabletask-go

KraftyOne · 15 days ago
That's interesting, I'll take a look! I had always thought of it as an Azure-only thing.
KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
krashidov · 15 days ago
How does this compare with inngest or restate? We currently use inngest right now and it works great but the typescript API is a bit clunky
KraftyOne · 15 days ago
Like Inngest and Restate, DBOS provides durable workflows. The difference is that DBOS is implemented as a Postgres-backed library you can "npm install" into your project (no external dependencies except Postgres), while Inngest and Restate require an external workflow orchestrator.

Here's a blog post explaining the DBOS architecture in more detail: https://www.dbos.dev/blog/what-is-lightweight-durable-execut...

Here's a comparison with Temporal, which is architecturally similar to Restate and Inngest: https://www.dbos.dev/blog/durable-execution-coding-compariso...

KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
blumomo · 15 days ago
I’m also interested in what you think can become best practices where we can have (auto-scaling) worker instances that can pick up DBOS workflows and execute them.

Do you think an app’s (e.g. FastAPI) backend should be the DBOS Client, submitting workflows to the DBOS instance? And then we can have multiple DBOS instances with each picking up jobs from a queue?

KraftyOne · 15 days ago
Yeah, I think in that case you should have auto-scaling DBOS workers all pulling from a queue and a FastAPI backend using the DBOS client to submit jobs to the queue.

Queue docs: https://docs.dbos.dev/python/tutorials/queue-tutorial Client docs: https://docs.dbos.dev/python/reference/client

KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
jumploops · 15 days ago
I've been looking at migrating to Temporal, but this looks interesting.

For context, we have a simple (read: home-built) "durable" worker setup that uses BullMQ for scheduling/queueing, but all of the actual jobs are Postgres-based.

Due to the cron-nature of the many disparate jobs (bespoke AI-native workflows), we have workers that scale up/down basically on the hour, every hour.

Temporal is the obvious solution, but it will take some rearchitecting to get our jobs to fit their structure. We're also concerned with some of their limits (payload size, language restrictions, etc.).

Looking at DBOS, it's unclear from the docs how to scale the workers:

> DBOS is just a library for your program to import, so it can run with any Python/Node program.

In our ideal case, we can add DBOS to our main application for scheduling jobs, and then have a simple worker app that scales independently.

How "easy" would it be to migrate our current system to DBOS?

KraftyOne · 15 days ago
I'd love to learn more about what you're building--just reach out at peter.kraft@dbos.dev.

One option is that you have DBOS workflows that schedule and submit jobs to an external worker app. Another option is that your workers use DBOS queues (https://docs.dbos.dev/python/tutorials/queue-tutorial). I'd have to better understand your use case to figure out what would be the best fit.

KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
darkteflon · 16 days ago
Often wondered whether it would be possible / advisable to combine DBOS with, e.g., Dagster if you have complex data orchestration requirements. They seem to deal with orthogonal concerns but complement nicely. Is integration with orchestration frameworks something the DBOS team has any thoughts on?
KraftyOne · 16 days ago
Would love to learn more about what you're building--what problems or parts of your system would you solve with Dagster vs DBOS?
KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
abtinf · 16 days ago
Why not just use Temporal?
KraftyOne · 16 days ago
We wanted to make workflows more lightweight--we're building a Postgres-backed library you can add to your existing application instead of an external orchestrator that requires you to rearchitect your system around it. This post goes into more detail: https://www.dbos.dev/blog/durable-execution-coding-compariso...
KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
alpb · 16 days ago
I've been following DBOS for a while and I think the model isn't too different than Azure Durable Functions (which uses Azure Queues/Tables under the covers to maintain state). https://learn.microsoft.com/en-us/azure/azure-functions/dura...

Perhaps the only difference is that Azure Durable Functions has more syntactic sugar in C# (instead of DBOS choice being Python) to preserve call results in the persistent storage? Where else do they differ? At the end, all of them seem to be doing what Temporal is doing (which has its own shortcomings and it's also possible to get it wrong if you call a function directly instead of invoking it via an Activity etc)?

KraftyOne · 16 days ago
Both do durable workflows with similar guarantees. The big difference is that DBOS is an open-source library you can add to your existing code and run anywhere, whereas Durable Functions is a cloud offering for orchestrating serverless functions on Azure.
KraftyOne commented on Build durable workflows with Postgres   dbos.dev/blog/why-postgre... · Posted by u/KraftyOne
tonyhb · 16 days ago
Anything that guarantees exactly once is selling snake oil. Side effects happen inside any transaction, and only when it commits (checkpoints) are the side effects safe.

Want to send an email, but the app crashes before committing? Now you're at-least-once.

You can compress the window that causes at-least-once semantics, but it's always there. For this reason, this blog post oversells the capabilities of these types of systems as a whole. DBOS (and Inngest, see the disclaimer below) try to get as close to exactly once as possible, but the risk always exists, which is why you should always try to use idempotency in external API requests if they support it. Defense in layers.

Disclaimer: I built the original `step.run` APIs at https://www.inngest.com, which offers similar things on any platform... without being tied to DB transactions.

KraftyOne · 16 days ago
As the post says, the exactly-once guarantee is ONLY for steps performing database operations. For those, you actually can get an exactly-once guarantee by running the database operations in the same Postgres transaction as your durable checkpoint. That's a pretty cool benefit of building workflows on Postgres! Of course, if there are side effects outside the database, those happen at-least-once.

u/KraftyOne

KarmaCake day627June 20, 2019
About
Hello! I'm Peter Kraft. I love databases and distributed systems and recently co-founded DBOS to make it easy for developers to build reliable and scalable cloud applications.

Website: http://petereliaskraft.net/

View Original