News for hackers. Stuff that matters.
Re:There's Just No Getting Around It: You're Building a Dist... by saryant on Thursday April 27, 2017 @11:52AM (#14212417)
That's... still a distributed system with all the joys of eventual consistency.
Re:There's Just No Getting Around It: You're Building a Dist... by jdc on Thursday April 27, 2017 @12:25PM (#14212727)
However, I do think the general consensus is that stateless/shared-nothing app servers and following something like the 12 Factor App[1] pattern makes things much easier.

1. https://12factor.net

Re:There's Just No Getting Around It: You're Building a Dist... by saryant on Thursday April 27, 2017 @01:02PM (#14213031)
Yes, it does.

But just because your storage layer is abstracted behind an API doesn't mean eventual consistency isn't your concern.

Take S3 for example.

LIST calls lag deletes but exists() doesn't, so exists() could return 404 for a document that's still included in the result of LIST. Plus, all exists() calls go through a caching load-balancer, so you could receive different answers in two subsequent exists() calls.

That's just a small subset. There's a good comment here[1] on S3's consistency semantics.

Point is, 12FA makes things easier but any time you have more than one computer involved (i.e, always), consistency becomes complicated.

[1] https://issues.apache.org/jira/browse/FLINK-5706

Re:There's Just No Getting Around It: You're Building a Dist... by zip1234 on Thursday April 27, 2017 @02:04PM (#14213518)
Seems like when cache needs to get involved, things can get complicated very quickly.
Re:There's Just No Getting Around It: You're Building a Dist... by dmoy on Thursday April 27, 2017 @02:41PM (#14213764)
One of the two hard problems...
Re:There's Just No Getting Around It: You're Building a Dist... by hamandcheese on Friday April 28, 2017 @12:07AM (#14216809)
I don't really see how your example applies to the point the root comment made. S3 surely _is_ a distributed system, but he is specifically talking about data residing on _one_ machine (notwithstanding the bits about read only followers).
Re:There's Just No Getting Around It: You're Building a Dist... by hueving on Thursday April 27, 2017 @01:48PM (#14213384)
Only if the db replicas allow stale reads.
Re:There's Just No Getting Around It: You're Building a Dist... by saryant on Thursday April 27, 2017 @02:52PM (#14213820)
A replica always lags master by some degree. It may be small—until things go sideways—but it's still another form of eventual consistency.
Re:There's Just No Getting Around It: You're Building a Dist... by peterwwillis on Thursday April 27, 2017 @03:07PM (#14213919)
You're saying ACID databases are eventually consistent?
Re:There's Just No Getting Around It: You're Building a Dist... by derefr on Thursday April 27, 2017 @03:21PM (#14214003)
They can be. Multi-master DB clusters, unless they're built on consensus (and boy how slow that would be), usually are.

Read-replicas, though, don't have much to do with that; a read-replica is essentially a point-in-time snapshot of the DB, that's going to get replaced with an updated snapshot every few milliseconds as WAL-log events stream in. That isn't "eventually consistent"; it's just "inconsistent." You're always looking at the past when you're talking to a read-replica.

If you need to update values using a client-side calculation, you'll need to do all that in a single transaction to get ACID guarantees. Since a transaction can only be "against" one node, and since the transaction will contain a write, that transaction (including both its reads and its writes) is forced to happen against a master node. A read-replica just isn't involved in the writing "story."

Re:There's Just No Getting Around It: You're Building a Dist... by saryant on Thursday April 27, 2017 @03:16PM (#14213968)
I'm saying read replicas are not instantly in sync with their masters. Updates are asynchronously copied to the replica.
Re:There's Just No Getting Around It: You're Building a Dist... by peterwwillis on Thursday April 27, 2017 @04:49PM (#14214571)
Or, you know, use synchronous replication, or semi-synchronous, or a different asynchronous model that isn't weakly consistent such as distributed transaction logs, write-read consensus, complicated locking mechanisms, etc
Re:There's Just No Getting Around It: You're Building a Dist... by saryant on Thursday April 27, 2017 @04:59PM (#14214654)
All of these solutions are still battling the fact that distributed systems are hard and there's a tradeoff to every decision.

If you use synchronous replication, you now require at least two systems to commit a write, so you've increased the chance that your commit will fail. Maybe that's the right choice—but it's a tradeoff and the decision ultimately rests in your business requirements.

My point is simply that there is no magic bullet in ensuring that all relevant systems have the same answer to the same question at the same time.

Re:There's Just No Getting Around It: You're Building a Dist... by di4na on Thursday April 27, 2017 @07:30PM (#14215732)
Especially on the load balancer side...