Distributed transactions in Go: Read before you try
threedots.tech
Distributed transactions in Go: Read before you try
1–10 of 58 posts
Re: Distributed transactions in Go: Read before you try
#2Re: Distributed transactions in Go: Read before you try
#3I think the author is a little too easily dismissive of sagas though - for starters, an event driven system is also still going to need to deal with compensating actions, its just going to result in a larger set of events that various systems potentially need to handle.
The virtue of a saga or some command driven orchestration approach is that the story of what happens when a user does X is plainly visible. The ability to dictate that upfront and figure it out easily later when diagnosing issues cannot be understated.
Re: Distributed transactions in Go: Read before you try
#4Re: Distributed transactions in Go: Read before you try
#5Oh man I feel this
Re: Distributed transactions in Go: Read before you try
#6If you're gluing microservices together using distributed transactions (or durable event queues plus eventual consistency, or whatever), the odds are good that you've gone far down the wrong path.
For many applications, it's easiest to start with a modular monolith talking to a shared database, one that natively supports transactions. When this becomes too expensive to scale, the next step may be sharding your backend. (It depends on whether you have a system where users mostly live in their silos, or where everyone talks to everyone. If your users are siloed, you can shard at almost any scale.)
Microservices make sense when they're "natural". A video encoder makes a great microservice. So does a map tile generator.
Distributed systems are expensive and complicated, and they kill your team's development velocity. I've built several of them. Sometimes, they turned out to be serious mistakes.
As a rule of thumb:
1. Design for 10x your current scale, not 1000x. 10x your scale allows for 3 consecutive years of 100% growth before you need to rebuild. Designing for 1000x your scale usually means you're sacrificing development velocity to cosplay as a FAANG.
2. You will want transactions in places that you didn't expect.
3. If you need transactions between two microservices, strongly consider merging them and having them talk to the same database.
Sometimes you'll have no better choice than to use distributed transactions or durable event queues. They are inherent in some problems. But they should be treated as a giant flashing "danger" sign.
Re: Distributed transactions in Go: Read before you try
#7Distributed systems spaghetti is much worse to deal with.
Re: Distributed transactions in Go: Read before you try
#8Let's assume you're not a FAANG, and you don't have a billion customers. If you're gluing microservices together using distributed transactions (or durable event queues plus eventual consistency, or whatever), the odds are good that you've gone far down the wrong path. For many applications, it's easiest to start with a modular monolith talking to a shared database, one that natively supports transactions. When this…
Various engineering leads, happy with what went on their resume, leave and tell everyone how they increased scalability. And persuade another generation of failures.
Re: Distributed transactions in Go: Read before you try
#9Re: Distributed transactions in Go: Read before you try
#10Let's assume you're not a FAANG, and you don't have a billion customers. If you're gluing microservices together using distributed transactions (or durable event queues plus eventual consistency, or whatever), the odds are good that you've gone far down the wrong path. For many applications, it's easiest to start with a modular monolith talking to a shared database, one that natively supports transactions. When this…
It's a balancing act, but putting out the fires before they even begin is often the wrong approach. Often a little fire is good for growth.