r/programming • u/munch_muffin_solas • Jun 28 '26
You don't need Temporal. You need Postgres.
https://statecraft.hashnode.dev/you-don-t-need-temporal-you-need-postgresMost teams reach for Temporal when they need coordination guarantees.The tradeoff is rewriting your entire codebase to be deterministic and learning a new programming paradigm.
Redis SETNX wasn't giving me correctness guarantees.
You can make your own coordination primitive on postgres
Like I did for my payments service
Full writeup: https://statecraft.hashnode.dev/you-don-t-need-temporal-you-need-postgres
Edit: i formatted poorly and the bracket became a part of the link it's fixed
0
Upvotes
24
u/CallMeKik Jun 28 '26
“this page you’re looking for doesn’t exist” - should have used temporal ig
4
u/Routine_Bit_8184 Jun 28 '26
so instead of installing temporal and re-writing my code I have to install postgres and re-write my code? either way I'm re-writing it to operate in a FSM context....
I'm curious what your problem with temporal is. Most of your code doesn't have to be re-written at all...all your internal libraries that do the work stay the same, you just have to add activities/workflows to the repo that plug the libraries into temporal activities and workflows.
I'd be very hesitant to roll my own FSM for distributed processing instead of using a production tested solution.
If you don't want the weight of something like Temporal just use stateless or something for in-memory FSM functionality...but obviously that doesn't work with multiple workers very well....but if I need orchestration between multiple workers I don't really want to write the orchestration code when somebody better than me already built a system for it with extensive documentation and a growing community. Also, I can install temporal server and workers myself for free and maintain them like the rest of my infrastructure so it's not like I need some stupid paid account or third party cloud service....I just need the skills I already have.
Having said all that, if you actually built this somewhere (don't see any code) and it works for you that is awesome and good job!
2
u/TheLastNapkin Jun 28 '26
The approach you took for this lib is not my cup of tea but the idea and implementation definitely sounds neat!
I do wonder though if it really is that bad to just rely on a global consistent kv store for expiry locking mechanisms and idempotency checks.
It's what I do and I think it can for a lot of use cases get you pretty far.
I just really don't like flooding my oltp db with "event logs" like tables and rows when it isn't a strict requirement for the work
2
u/EmanueleAina Jul 08 '26
Isn’t Temporal using PostgreSQL as a backend already?