Live data from Hacker News

Consistency is Consistently Undervalued

kevinmahoney.co.uk

11–20 of 131 posts

Re: Consistency is Consistently Undervalued

#11
post #4

And in case you think there's a general solution to that problem, there isn't: https://en.wikipedia.org/wiki/CAP_theorem Still, it's funny how banking seems to be the canonical example for why we need transactions given that most banking transactions are inconsistent ( http://highscalability.com/blog/2013/5/1/myth-eric-brewer-on... ).

Oh, in addition to my other reply I should point out that the 'C' in CAP is not the same thing as the 'C' in ACID. Be careful with that one, it can cause confusion! http://blog.thislongrun.com/2015/03/the-confusing-cap-and-ac...

Re: Consistency is Consistently Undervalued

#13
post #7

But consider this: You are using mysql, you make a transaction with say deposit and withdraw. What happens on the mysql machine if you pull the plug exactly when mysql has done the deposit but not the withdraw? The ONLY difference between SQL transactions and NoSQL microservice transactions is the time between the parts of a transaction. Personally I use a JSON file with state to execute my NoSQL microservice transac…

I don't mean to be unkind, but is this meant to be a parody?

There are no "parts of a transaction" because a transaction is definitionally atomic.

Transactional file modification is a fairly tricky problem, and I'd be surprised if you'd actually implemented a safe system in that manner. What's certain though is that spinning up MySQL or Postgres and using it to store simple records is essentially a zero-cost setup task - so I doubt it's ever going to "hog all your time and resources".

Re: Consistency is Consistently Undervalued

#15
I think it's a bad example because this should not be the way to develop in this kind (microservices) of systems.

In these environments you atomically create objects in your application's "local" storage and have a reconciliation loop for creating objects in other services or deleting these orphan "local" objects.

Re: Consistency is Consistently Undervalued

#16
Good article.

I've stopped using bank transfers as an example for Acid transactions, and instead talk about social features:

- if I change a privacy setting in Facebook or remove access to a user, these changes should be atomic and durable

- transactions offer a good semantic of which to make these changes. They can be staged in queries, but nothing is successful until after a commit.

- without transactions durability is hard to offer. You would essentially need to make each query flush to disk, rather tha each transaction. Much more expensive.

Re: Consistency is Consistently Undervalued

#17
post #15

I think it's a bad example because this should not be the way to develop in this kind (microservices) of systems. In these environments you atomically create objects in your application's "local" storage and have a reconciliation loop for creating objects in other services or deleting these orphan "local" objects.

I think it's a good example because this should not be the way to develop this kind of system - and yet people do it this way! :)

Re: Consistency is Consistently Undervalued

#18

Why isn't the OP using Event Sourcing "commands" for the "Bank Accounts" example?

I believe Event Sourcing opens a whole other can of worms which would detract from the point of the article, such as whether the event streams have a well-defined order (especially if each account is its own aggregate), or whether the resulting event should be "Transaction Completed" (assumes pre-conditions were checked) or "Transaction Attempted" (checks pre-conditions before altering state).

Re: Consistency is Consistently Undervalued

#19
Transactions can have different isolation levels. And sometimes the problem at hand can be implemented using transactions with weak isolation levels which are not that hard to implement using your favorite NoSQL database that support CAS operation. I recommend this article: http://rystsov.info/2012/09/01/cas.html

Re: Consistency is Consistently Undervalued

#20

Why isn't the OP using Event Sourcing "commands" for the "Bank Accounts" example?

I'm not actually that familiar with event sourcing. I'd be interested in reading more if you have a pointer to some resources!

Edit: I wasn't familiar with the terminology, but it sounds like what I have written about here: http://kevinmahoney.co.uk/articles/immutable-data/

Post reply on HN