News for hackers. Stuff that matters.
Re:Pick strong consistency whenever possible by jedberg on Monday January 15, 2018 @07:28PM (#16154767)
I used to agree until I was forced to use an eventually consistent system.

Both have their place, but I think you get better architected, more reliable software with an eventually consistent system.

In and eventually consistent system, the programmer must consider what to do in the case of data failure. I think this is a good thing. When building a user authentication system, who better to decide what to do when you can't access the user database than the person writing the user auth system? Should it fail open or closed? Well if you're a bank, you should probably fail closed. If you're Netflix? Fail open. The programmer should know the business case better than the database, which will alway fail closed.

Sure, in a consistent system the programmer could think about that, but they aren't forced to, which I think is good.

Also, it means that joins must be done in your application. Sometimes its good to have the programmer deal with that too, because it means they will have to really consider what data they need and be much more familiar with how much data is needed to create the join. If you're just relying on the database to do the joins, it might be hiding a lot of load from you, especially if you inadvertently create multiple table scans. In an eventually consistent system, you know if you created a table scan, because you have to pull back a full table's worth of data (or not, because you saw that issue and fixed it).

I just feels like the programmer gets better insight into what is happening to the data and can make better decisions on what to do when they are closer to the business cases the software is being built for.

Re:Pick strong consistency whenever possible by mayank on Tuesday January 16, 2018 @01:37AM (#16156265)
I think you may have some misconceptions about what consistency means in this context.

> In and eventually consistent system, the programmer must consider what to do in the case of data failure.

Eventually consistency has nothing to do with data failure; the real-world effect of eventually consistency is stale data, which you can't generally tell is stale.

> When building a user authentication system, who better to decide what to do when you can't access the user database than the person writing the user auth system?

I think you're talking about availability, not (eventual) consistency.

> Also, it means that joins must be done in your application.

There is nothing preventing you from doing joins in a strongly consistent database. Google Spanner supports JOINs for example [1].

> In an eventually consistent system, you know if you created a table scan, because you have to pull back a full table's worth of data

This also has nothing to do with eventual consistency.

[1] https://cloud.google.com/spanner/docs/query-syntax#join-hint...

Re:Pick strong consistency whenever possible by jetcata on Tuesday January 16, 2018 @01:44AM (#16156291)
Agree with above, I'm not sure why that comment is most upvoted, it's poorly written and the author doesn't seem to have a good grasp of distributed systems concepts.
Re:Pick strong consistency whenever possible by hueving on Tuesday January 16, 2018 @02:39AM (#16156468)
Vague "I agree" criticisms make for poor reading. Provide specific counter examples like the parent or don't bother commenting.
Re:Pick strong consistency whenever possible by jedberg on Tuesday January 16, 2018 @04:18AM (#16156822)
I was using "eventually consistent system" as a shorthand for "multi-master database that is eventually consistent" which may have been confusing.
Re:Pick strong consistency whenever possible by jedberg on Tuesday January 16, 2018 @04:24AM (#16156835)
I was using "eventually consistent" as a shorthand for "multi-master highly-available key-value distributed database". Most people who don't work in the space regularly consider them the same thing. Basically Cassandra/DynamoDB vs Cloud Spanner.

> Eventually consistency has nothing to do with data failure; the real-world effect of eventually consistency is stale data, which you can't generally tell is stale.

You're right, that is the highly available distributed part, but it goes along with eventual consistency because if you plan for dealing with stale data then those same concepts protect you from unavailable data.

> I think you're talking about availability, not (eventual) consistency.

Again, the two go hand in hand. Deal with stale data and you've dealt with unavailable data.

> There is nothing preventing you from doing joins in a strongly consistent database.

You misread -- I was saying that with a multi-master key-value system you have to do joins in the app.

> This also has nothing to do with eventual consistency.

Same, I was talking about Dynamo-like systems.

Re:Pick strong consistency whenever possible by mayank on Tuesday January 16, 2018 @11:31AM (#16159379)
Hey, appreciate the attempt at clearing things up, but I’m afraid your original comment is still quite wrong.

It looks like you’re conflating a well-defined term in distributed systems with properties of particular database implementations that have nothing to do with eventual consistency.

Nothing in your reply is a necessary property of eventually consistent systems, although some eventually consistent systems may be built with those properties. That is quite a huge difference when we’re in the context of the blog post being discussed.

The grayness of your reply should suggest that perhaps you’re misusing the term, rather than everyone else being “confused”.

Re:Pick strong consistency whenever possible by cookiecaper on Monday January 15, 2018 @09:15PM (#16155258)
I agree with the principle that good development practices will try to get the coder to think through the potential failure modes of the code they've written.

Unfortunately, I think you've come to the opposite conclusion in this case. When jedberg writes the code for a system backed by an eventually-consistent data store, he asks "What happens if this value is stale and how can I structure the code to cope with that in a sane and reasonable way?"

But when $Random_Dev writes the code for such a system, he asks some combination of "What does eventually consistent mean?", "What do you mean I won't get back the right data?", and "Isn't that the DBA's problem?"

The core issue being that the average dev will punctuate this line of questioning with things that shift the blame elsewhere; if not the DBA, then "Well, it's good enough for [INSERT_TRENDY_COMPANY_HERE] [ reddit? ;) ], so I think we'll be OK!" or "I don't think that will ever happen to us, our reads get consistent quickly enough". Just whatever will punt the issue down the road.

To be honest, I believe that this impulse is the impetus behind the rise in NoSQL in the first place. Devs resent DBAs and SQL. They, very simply, want a place to shove their data, a place to read it out, and to not know anything else about the in between. I have seen many pitiful architectures that clearly turned on this consideration (and we're seeing it all over again with cloud orchestration).

Good developers will dig in and search out the meaning of the data whether the failure case is handled at the DB level or not.

Highly-structured systems like a traditional RDBMS are very good for resiliency because they require someone to put some definition and formality around the dataset to get basic functionality, and they are generally extremely careful about ensuring the things that come in and out of them are safe and accurate. That's the kind of backing that we really need, especially when there are many developers who can't be trusted to even try to understand more than the bare minimum necessary to get a positive quarterly review.

Re:Pick strong consistency whenever possible by lmm on Tuesday January 16, 2018 @05:56AM (#16157261)
> Highly-structured systems like a traditional RDBMS are very good for resiliency because they require someone to put some definition and formality around the dataset to get basic functionality, and they are generally extremely careful about ensuring the things that come in and out of them are safe and accurate.

That's not what happens in practice. Just because an RDBMS has transactions doesn't mean a programmer who isn't trying is going to use them correctly. And when you do enforce constraints at the DB level, you end up duplicating all your logic in two different languages, one of which isn't very nice for programming in. E.g. I've never found database timezone handling to be anything other than harmful. The application is just better at enforcing this kind of constraints; a well-designed application could make use of transactionality, but putting the transactionality in the datastore won't make the application better at it if the dev wasn't thinking about it - and if the dev is thinking about it, they can usually do better at the application level.

Re:Pick strong consistency whenever possible by cookiecaper on Thursday January 18, 2018 @11:43AM (#16178503)
>Just because an RDBMS has transactions doesn't mean a programmer who isn't trying is going to use them correctly.

Definitely true, but RDBMS provide a lot of safety features beyond transactions, like a fixed schema. Mongo et al let developers stuff anything they want anywhere, creating an abominable bastardization between a key-value store and a database. That's their "killer feature" that has resulted in wide adoption so they can't really do away with it, even if some [likely reluctant] Mongo users continue to find ways to self-enforce a schema.

It'd be one thing if Mongo was predominantly used as a staging ground for free-form, unpredictable data, but I think we all know that's not the case. People pretend like it's a replacement for a traditional RDBMS.

>a well-designed application could make use of transactionality, but putting the transactionality in the datastore won't make the application better at it if the dev wasn't thinking about it - and if the dev is thinking about it, they can usually do better at the application level.

I really disagree here. The semantics and detail involved in _actually_ making sure a datum is securely stored, including a high likelihood of being recoverable in the case of a crash, is very complex in any non-trivial system. It's dismissive and naive to pretend that your average application developer, who generally doesn't even know what `fsync()` is, can do a better job at this than a real database, which will include advanced consistency features like intent logs.

Re:Pick strong consistency whenever possible by lmm on Wednesday January 24, 2018 @12:19PM (#16224365)
> Mongo et al let developers stuff anything they want anywhere, creating an abominable bastardization between a key-value store and a database. That's their "killer feature" that has resulted in wide adoption so they can't really do away with it, even if some [likely reluctant] Mongo users continue to find ways to self-enforce a schema.

Their real killer feature was proper multi-master clustering - being able to seamlessly add and remove nodes from your storage cluster - in a free product. Traditional RDBMS don't do that.

> The semantics and detail involved in _actually_ making sure a datum is securely stored, including a high likelihood of being recoverable in the case of a crash, is very complex in any non-trivial system. It's dismissive and naive to pretend that your average application developer, who generally doesn't even know what `fsync()` is, can do a better job at this than a real database, which will include advanced consistency features like intent logs.

Intent logs are necessary precisely because the database table model is a poor fit for what actually happens - even databases themselves now spend more effort on converting back and forth to the SQL model than on actual storage or query implementation. A developer with the skills to do it right does need a library of certain capabilities, but the RDBMS is not a good interface for supplying them with those capabilities. See e.g. https://www.confluent.io/blog/turning-the-database-inside-ou... .

Re:Pick strong consistency whenever possible by scarface74 on Tuesday January 16, 2018 @05:43AM (#16157203)
Mongo with a strongly typed language also encourages someone to put some definition around the dataset. That someone is just the developer creating the PO*O (Plain Old [C#/Java, etc] object).

In C# for instance using the standard Mongo driver, you're dealing with strongly typed collections and the compiler is keeping you from mistakingly going outside of the "schema".

I don't know how good the other .Net drivers are for other Nosql databases.

Re:Pick strong consistency whenever possible by jedberg on Monday January 15, 2018 @09:24PM (#16155295)
Your point is valid, but it makes me sad.

We basically come from opposite viewpoints -- I think most devs will do the right thing, you think most will do the wrong thing.

Honestly, you're probably right and I'm probably wrong, but I like to hope that I will always work in a place where I'm right. :)

(It was Netflix BTW, not reddit. For the most part reddit used strongly consistent databases (Postgres), but we did use some eventual consistency in the caching layer).

Re:Pick strong consistency whenever possible by lulmerchant on Monday January 15, 2018 @09:44PM (#16155388)
I have a slightly different perspective. I think defaulting to NoSQL is simply removing a mature toolset from the developers kit, that they would have a lot of great use cases for.

If you use it in the wrong places, then that almost certainly means increases complexity where you don't necessarily have to. Whether or not that results other positive behaviours seems a bit beside the point to me.

If you managed a team of rock climbers, you could say "I prefer it when my rock climbers don't use safety ropes. It improves their climbing, because if they make a mistake, they'll fall to their death". It could be 100% true, but it doesn't mean you shouldn't simply be picking the right tools for the job.

Re:Pick strong consistency whenever possible by AlexCoventry on Tuesday January 16, 2018 @01:33AM (#16156252)
Yeah, the dichotomy in this conversation is strange.
Re:Pick strong consistency whenever possible by jitl on Tuesday January 16, 2018 @01:37AM (#16156268)
> I think most devs will do the right thing, you think most will do the wrong thing.

This comes down to culture. I wish I knew how to create a culture where devs do the right thing, from a culture where they ¯\_(ツ)_/¯.

Maybe you need the very clearly Netflix model of "Fire every ¯\_(ツ)_/¯"

Re:Pick strong consistency whenever possible by jopsen on Monday January 15, 2018 @09:38PM (#16155360)
Most people don't get consistency right...

Outside of AWS, Google and Azure I see few cloud services that define their consistency models. And support always says: we are high availability and always consistent.

Same goes for distributed software, few projects define their consistency model, and even fewer honor it.

Re:Pick strong consistency whenever possible by StillBored on Monday January 15, 2018 @10:22PM (#16155540)
I agree with this 100%, the problem is the eventual consistency model opens up the failure windows. Its the case of the private toll agency here in TX that had a full blown court case/collections agency trying to collect (thousands for literally $2.75 in tolls) from me, while sending information to my 5 year out of date address.

That despite the fact that I changed my address when I moved (says so in the TxDPS record, running on a "legacy" system), which got sent to the toll agency when I changed it. Of course somewhere in there the toll agency lost this information and never bothered to check the TxDPS record until I pointed out they were repeatedly sending notices to the wrong address.

The point being that, this is only one of many problems they have had with their newfangled toll system because sometimes "eventually consistent" actually means "we threw the update away because a newer one came in, so we lost a critical piece of information.". Critical pieces of information like, people actually paying their tolls for example.

http://www.texasturf.org/2012-06-01-03-09-30/latest-news/484... http://story.kxan.com/txtag-troubles/ https://www.reddit.com/r/Austin/comments/78wp9y/txtag_paymen...

Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @07:42PM (#16154881)
I'm not sure I follow your example. Is anyone actually "failing open" for user authentication? Why?

I think I can understand some of your point. Trust should be engineered into the system, not assumed. That is a lot of work and not easy, though. (I think this ultimately lands on the block chain idea of the world. I'm fairly ignorant there.)

Strong consistency just means that you can expect any accesses you performed to be consistent in time with each other, right? To that end, it is nice not having to effectively do a "loopUntilChangeReflected" after every write and checking to see if it is safe to do the next thing. Which you have to do in an eventually consistent world.

Re:Pick strong consistency whenever possible by cookiecaper on Monday January 15, 2018 @09:33PM (#16155332)
> To that end, it is nice not having to effectively do a "loopUntilChangeReflected" after every write and checking to see if it is safe to do the next thing. Which you have to do in an eventually consistent world.

If you have to do this, you probably shouldn't be using an eventually consistent system. Eventually consistent systems should only be deployed when a stale read is harmless. For example, it probably isn't a big deal if something reads "5 upvotes" instead of "7 upvotes" before a change fully propagates out.

Wrapping every write in a "block to ensure consistency" loop is just a lossy, slow, terrible and dangerous way to recapture a tiny amount of the consistency available to those who use a system that suits their needs.

I know that in the real world, we don't often get to make these decisions, or there may be one-off edge cases (though really just put these on a system that's safe for them). But I just want to point out to other readers that if you catch yourself doing this, you just need to use a datastore that fits your application's use case.

Yes, even if you just read an article in TechCrunch about the Hippest Coolest Hottest Big-Dataiest 2.0 3.0 4.0 5.0 Data Storage Project That Makes Google and Facebooks' Mouths Water Hadoop-Daboop Machine, That Only Cool People Use, and No Uncool People Or Trump Supporters Of Any Kind Allowed.

Read that article, and then go use Postgres.

Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @10:36PM (#16155610)
Fair. I was overly silly in my example there.

I'd still argue that even reasoning about all writes in an, "eventually this is true for everyone else," fashion is less than straight forward.

To that end, components should all be able to assume what they do is strongly consistent. If possible, assume everyone else is behind?

Re:Pick strong consistency whenever possible by IgorPartola on Monday January 15, 2018 @07:47PM (#16154903)
Not that I necessarily agree, but what GP is saying is that say you have a distributed DB backing your auth system, and there is a partition. The user tries to log in and you can’t be sure that their account is still valid because of the partition, but because all they are trying to do is watch a movie, just let them in based on the data that the partition you do have access to.

This is in contrast to a bank which should always operate only when there is no partition.

Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @08:32PM (#16155092)
That makes sense, but how do you encode it? The auth system now does not return authorized or not authorized, but authorized or maybe authorized? Seems much easier to just rely on auth being a yes or no. Possibly with an expiration for how long a yes can be trusted.

That is, how is it simpler to assume that the data you get back could be wrong? Now, anyone involved with the system seems to have to know how everyone involved in the system interprets results.

Re:Pick strong consistency whenever possible by sangnoir on Tuesday January 16, 2018 @12:32AM (#16156052)
> Now, anyone involved with the system seems to have to know how everyone involved in the system interprets results.

This meshes with the articles assertion: strong consistency leads to fewer bugs because fewer possible states exist at application level.

Re:Pick strong consistency whenever possible by jedberg on Monday January 15, 2018 @09:20PM (#16155276)
It allows the person writing the business software layer to make a decision that fits that business use case independent of how others interpret it. But no one else needs to know how it works.

If the "play movie" service calls the auth service and says "should I let this play", the auth service returns "authorized" or didn't give a response or said "maybe authorized" or whatever. The "play movie" service makes the business decision that makes sense for playing a movie, in this case, "go ahead".

But the billing service maybe says "I'm only gonna let you in with a confirmed yes". So it's possible the billing service will give you an error in the same conditions that the movie service does not, but those are business decisions instead of technical ones, which is good.

Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @09:30PM (#16155316)
This doesn't sound like a consistency debate, though. Distributed system, yes. Weak consistency, though?

I'd want strong semantics on, "what is allowed with an authenticated connection with an authentication that is X old?". Preferably, I'd want a somewhat knowable centralized list of the answers. These are not software concerns, but business ones. Right?

Re:Pick strong consistency whenever possible by jedberg on Monday January 15, 2018 @07:59PM (#16154965)
> Is anyone actually "failing open" for user authentication?

Netflix did for a while at least, may still do it. Worst case is that someone didn't pay for the month. The partitions happen rarely enough that it is better to give the user a good experience then not let a legit user in because of a network partition.

But the nice part is that this was a business decision, not a database decision.

Re:Pick strong consistency whenever possible by sk5t on Monday January 15, 2018 @09:11PM (#16155243)
Billing is not authentication, it's a facet of authorization. In any event, it would be pretty lousy if Netflix exposed account details, viewing history, etc., to loosely-authenticated accounts.
Re:Pick strong consistency whenever possible by jedberg on Monday January 15, 2018 @09:13PM (#16155254)
It was only for playing a movie. But that right there is a perfect example of why the logic should be at the business level and not the database level.

Allow them to watch a movie, but don't show billing details.

Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @09:25PM (#16155299)
This is still worded poorly. You aren't skipping authentication for these people. You just aren't doing it again.

In theater parlance, people in the theater are assumed authorized to be there by virtue of the entrance requiring authorization.

Right?

Similarly, this had little to do with consistency. Any client that makes a logout should assume the connections it has are no longer valid. To assume otherwise seems odd. Worse, to encourage relying on it.

Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @08:29PM (#16155079)
This sounds suspicious. They had other mechanics to guard against abuse than auth?

Worst case would be a renegade client that constantly used the open door, no?

Re:Pick strong consistency whenever possible by EgoIncarnate on Monday January 15, 2018 @09:01PM (#16155201)
I think this is a backend thing, so renegade client isn't an issue. The choice is: if the auth system was down, should the video system prevent everyone from seeing video, or let everyone in. If auth is down, some people will be able to watch when the shouldn't be able to, but only for the period of time while the auth system is down.
Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @09:22PM (#16155281)
Wouldn't this only allow recently authenticated people in? That is, connections at this point can check if there is an "authenticated" flag set. Assuming any basic expiration, the only people getting through this are those that have recently lost authorization. They were still authenticated. Right?
Re:Pick strong consistency whenever possible by EgoIncarnate on Monday January 15, 2018 @09:30PM (#16155318)
If auth is up, everything works as normal. If it's down let everyone in.

I'm envisioning something on the backend equivalent to:

OnGetVideoChunkRequest: if Authorized(User) or IsDown(AuthSystem) then SendVideoChunk

Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @10:07PM (#16155475)
Makes sense. Still surprises me that it wouldn't be a check more like "if not expiredOrAbsentAuthentication..."
Re:Pick strong consistency whenever possible by EgoIncarnate on Monday January 15, 2018 @10:39PM (#16155619)
I think you're overly focusing on details. Authorized(User) might check expiration or other things, but that isn't really relevant to the fail open vs fail close idea being discussed.
Re:Pick strong consistency whenever possible by taeric on Tuesday January 16, 2018 @12:00AM (#16155958)
I'm focused on connections. All systems should not have to connect back to the auth system to do their job. To that end, determining that a connection is trusted is not a weak versus strong consistency issue.

Now, checking a password in the system should be strongly consistent. In that I should be able to update my password and immediately use the updated password. Any other behavior will surprise me.

Re:Pick strong consistency whenever possible by EgoIncarnate on Tuesday January 16, 2018 @12:23AM (#16156027)
I wouldn't take my example too literally. The example was just to illustrate the basic logic for fail open and intentionally wasn't complete or detailed.

For purposes of discussing fail open, how that logic gets translated during implementation doesn't matter. Authorized(User) might be expiring tokens passed in via cookie. IsDown(AuthSystem) could just check some global flag that gets set by some watchdog service on a AuthSystem heartbeat. It could be something else. It doesn't matter because it's not relevant.

Having a direct connection to the AuthSystem or not is an implementation detail, not something that changes the idea "Netflix should fail open".

Re:Pick strong consistency whenever possible by taeric on Tuesday January 16, 2018 @12:48AM (#16156115)
I suspect it is just focusing on an example. So, to that, apologies if I am over diluting the conversation. Rereading my first post, I should have been clearer that I can agree with the point. Just don't know if auth is the domain I would pick, since it isn't a persisted thing, but a vouched one.

Similarly, anywhere you are doing idempotent guarantees, strong consistency is vital. Same for customer interaction. Reads following writes that a user made should almost certainly strive for strong consistency. If only to avoid confused customers.

Writes the system makes, though? Expect those to just fail in ways that will leave things inconsistent and constantly check for them.

Re:Pick strong consistency whenever possible by jedberg on Monday January 15, 2018 @09:12PM (#16155248)
It would only fail open if the connection from the auth service to the database was down. It's all server side.
Re:Pick strong consistency whenever possible by taeric on Monday January 15, 2018 @09:26PM (#16155303)
See my sibling response. This doesn't sounds like a consistency debate as much as a trusted connections debate.
Re:Pick strong consistency whenever possible by Retra on Monday January 15, 2018 @07:40PM (#16154861)
I don't think you can just set a line like that. Eventually the programmer might want to consider what to do in the case of data failure. Otherwise, why even write shared code? The programmer might be wise to write all their software from scratch, affording every consideration where they know best, but they certainly won't want to start there. And this says nothing for teams where people leave and enter over time and persistent experience is ephemeral.
Re:Pick strong consistency whenever possible by jedberg on Monday January 15, 2018 @08:07PM (#16154996)
This is a fair point. Maybe the engineer doesn't think about it, but at least some engineer wrote a library that takes care of it, instead of relying on the database to do it. And even with a consistent system, maybe they are still using a library.

But my point was eventually consistent systems, in general, force you to think about these things earlier on. Of course there are exceptions in both directions.

Re:Pick strong consistency whenever possible by daxfohl on Tuesday January 16, 2018 @01:07AM (#16156180)
Wow, I so strongly disagree with this. I'm currently working on a system backed by DocumentDB, and had a solution for the core of our application written out in a 13-line javascript stored procedure. The edict came down from above: no stored procedures because scalability. No analysis, no real-world data (we're currently doing a few transactions per day; my understanding is that stackoverflow uses SQL server and scales just fine), just idealism. So we set off to push our stored proc logic into a lazily-consistent background job. I hated the idea initially, but the result turned me off of eventual consistency permanently.

This is because, not only did we develop an edict against stored procedures, but we then developed an edict that everything must be done using the lowest consistency model possible. We ended up settling on session consistency. TBH we discovered an algorithm that didn't even require session consistency, but the latency would have been to great. Again, no particular analysis or rationale for the edict, just idealism. The end result was a system that, for each update, required six background jobs to be launched, which each launched their own cascading jobs that patched up the data. And our records all had to be peppered with version fields and updated-by-job fields and version-of-foreign-key fields that these fixup jobs had to test against to make sure they're not operating against stale data or running over each other, such that this crap actually outweighs the actual data in the records. And these background jobs manage state in Table Storage and transfer messages via Service Bus, so two more SPOFs not to mention all the extra compute resource cost. It's a huge mess of a jenga puzzle that's taken months to implement and code review and test, and now even six months later we're still finding edge cases that aren't handled correctly (or are they? you have to constantly go through from the start to really understand it). In addition, since things are never guaranteed to be in a consistent state, that means we could have foreign keys that don't reference anything, or circular graphs where cycles should be disallowed, or whatever else at any moment in time, and so we have to fudge this stuff when presenting data to the user, and it reduces our ability to do any sort of meaningful statistics on our data. To remove 13 lines of javascript. It's just a mess.

And then what happened is a couple new requirements came in that couldn't be reasonably handled in a lazy fashion, so we ended up using stored procs for that logic anyway.

Now, to be clear, the resulting system is strictly more scalable than the stored proc based one. One could in theory just throw more machines at any load and it'll continue to work. So there's that. But a) the load beyond which the stored proc system could scale is about 3 orders of magnitude higher than even our optimistic usage estimates in the foreseeable future, and b) the lazy algorithm requires so much additional compute overhead that, while infinitely scalable, would we even be able to afford it anymore?

So for my money, give me a strongly consistent system by default. I don't even particularly understand the argument given above. With a strongly consistent system, you can still choose to do things like join in the client if there's a reason for it. But going the opposite way and forcing consistency to be unassumed everywhere produces the mess we're dwelling in now.

Now, certainly there are cases where eventual consistency is better: high-write-volume on not-very-relational data where point-in-time accuracy isn't super business-critical is where it typically shines. At the "edges" of your system, essentially. But I do want to point out some of the pain that can be encountered if it's chosen for the wrong use case, and make sure that anyone who does use it in their core application logic knows what they're in for, and puts some more thought into whether it's what they really want.

Re:Pick strong consistency whenever possible by lmm on Tuesday January 16, 2018 @05:50AM (#16157236)
> The end result was a system that, for each update, required six background jobs to be launched, which each launched their own cascading jobs that patched up the data. And our records all had to be peppered with version fields and updated-by-job fields and version-of-foreign-key fields that these fixup jobs had to test against to make sure they're not operating against stale data or running over each other, such that this crap actually outweighs the actual data in the records.

That sounds bad. The way you're supposed to do it is have the initial data be immutable and compute the downstream data separately, but into its own places.

> So for my money, give me a strongly consistent system by default. I don't even particularly understand the argument given above. With a strongly consistent system, you can still choose to do things like join in the client if there's a reason for it. But going the opposite way and forcing consistency to be unassumed everywhere produces the mess we're dwelling in now.

I'd say transactions should never be the default, because a database transaction that isn't a semantic transaction is worse than useless. If the application programmer hasn't thought about transactionality and synchronization, it's much better for that to show up as not having any transactions - you can fix that, by adding transactions where you need them - than to have transactions that don't mean anything, and the data ending up inconsistent even though no transactions ever overlapped.

Re:Pick strong consistency whenever possible by jedberg on Tuesday January 16, 2018 @04:27AM (#16156849)
It sounds like your root problem was dogmatic thinking, not any sort of consistency model.

There is a time and place for eventual consistency and multi-master, and there is a time for strongly consistent SQL servers.