zlacker

[parent] [thread] 26 comments
1. lmm+(OP)[view] [source] 2021-11-26 08:57:57
Sometimes I wonder if I'm the crazy one. Kafka seems to me to be the only sensible foundational datastore out there: it can maintain and propagate a log with all the properties you would want a datastore to have. Relational database seem to be a crazily overengineered solution in search of a problem, with incredibly poor reliability properties (essentially none of them are true master-master HA out of the box, and they tend to require significant compromises to make them so) to boot.
replies(3): >>valent+W >>dmitri+z7 >>2-718-+nz
2. valent+W[view] [source] 2021-11-26 09:08:53
>>lmm+(OP)
Both are good for different purposes.

Want to store data, query it in arbitrary and hard to foresee ways and also want to easily tune performance for these queries? Relational datastore it is.

Want to have ACID? Well, relational datastore it is.

Kafka is not the right solution for these problems.

3. dmitri+z7[view] [source] 2021-11-26 10:27:38
>>lmm+(OP)
> Relational database seem to be a crazily overengineered solution in search of a problem

I mean, whoever in their right mind would want to:

- have a snapshot of data

- query data, including ad-hoc querying

- query related data

- have trasactional updates to data

When all you need is an unbounded stream of data that you need to traverse in order to do all these things.

replies(2): >>lmm+f9 >>LgWood+Sy
◧◩
4. lmm+f9[view] [source] [discussion] 2021-11-26 10:52:15
>>dmitri+z7
> - have a snapshot of data

Being able to see a snapshot is good, and I would hope to see a higher-level abstraction that can offer that on top of something Kafka-like. But making the current state the primary thing is a huge step backwards, especially when you don't get a history at all by default.

> - query data, including ad-hoc querying

OK, fair, ad-hoc queries are one thing that relational databases are legitimately good at. Something that can maintain secondary indicies and do query planning based on them is definitely useful. But you're asking for trouble if you use them in your live dataflow or allow ad-hoc queries to write to your datastore.

> - have trasactional updates to data

I do think this one is genuinely a mistake. What do you do when a transaction fails? All of the answers I've heard imply that you didn't actually need transactions in the first place.

replies(3): >>irl_ch+5a >>dmitri+Ma >>Ma8ee+ai
◧◩◪
5. irl_ch+5a[view] [source] [discussion] 2021-11-26 11:03:03
>>lmm+f9
You think transactional updates are a mistake? I guess you’ve never had to worry about the integrity of your data?

Bank -> debit card purchase -> perform all required database work in a transaction -> transaction fails -> decline debit card purchase

Without transactions, in this scenario, maybe the debit card transaction fails but money is still taken out of your account? Doesn’t sound very pleasant.

replies(1): >>lmm+0c
◧◩◪
6. dmitri+Ma[view] [source] [discussion] 2021-11-26 11:15:14
>>lmm+f9
> But making the current state the primary thing is a huge step backwards

Why?

When is "I need to query all of my log to get the current view of data" is a step forward? All businesses operate on the current view of data.

> OK, fair, ad-hoc queries are one thing that relational databases are legitimately good at.

Not just ad-hoc queries. Any queries.

> But you're asking for trouble if you use them in your live dataflow or allow ad-hoc queries to write to your datastore.

In our "live datafows" etc. we use a pre-determined set of queries that are guaranteed to run multiple orders of magnitude faster in a relational database on the current view of data than having to reconstruct all the data from an unbounded stream of raw events.

> What do you do when a transaction fails?

I roll back the transaction. As simple as that.

replies(1): >>lmm+Vc
◧◩◪◨
7. lmm+0c[view] [source] [discussion] 2021-11-26 11:32:37
>>irl_ch+5a
Database transactions would be useless for banks - you'll notice that if you try to pay while not having enough money in your account, the attempt doesn't simply disappear. What banks actually do is something akin to what Kafka-based systems do - the attempt to charge is recorded in a leger, and then fulfilment of that happens asynchronously.
replies(2): >>KptMar+7h >>marcos+fL
◧◩◪◨
8. lmm+Vc[view] [source] [discussion] 2021-11-26 11:41:01
>>dmitri+Ma
> All businesses operate on the current view of data.

All businesses operate in response to events. Most of the things you do are because x happened rather than because the current state of the world is y.

> In our "live datafows" etc. we use a pre-determined set of queries that are guaranteed to run multiple orders of magnitude faster in a relational database on the current view of data than having to reconstruct all the data from an unbounded stream of raw events.

If you have a pre-determined set of queries, you can put together a corresponding set of stream transformations that will compute the results you need much faster than querying a relational database.

> I roll back the transaction. As simple as that.

And then what, completely discard the attempt without even a record that it happened?

replies(1): >>dmitri+9e
◧◩◪◨⬒
9. dmitri+9e[view] [source] [discussion] 2021-11-26 11:50:06
>>lmm+Vc
> All businesses operate in response to events.

Yes, but once an event happens, business needs access to current state of data.

> If you have a pre-determined set of queries, you can put together a corresponding set of stream transformations that will compute the results you need much faster than querying a relational database.

No, it won't. Because you won't be able to run "a corresponding set of transformations" on, say, a million clients.

You can, however, easily query this measly set on a laptop with an "overengineered" relational database.

> completely discard the attempt without even a record that it happened?

Somehow in your world audit logging doesn't exist.

replies(1): >>lmm+3h
◧◩◪◨⬒⬓
10. lmm+3h[view] [source] [discussion] 2021-11-26 12:16:34
>>dmitri+9e
> No, it won't. Because you won't be able to run "a corresponding set of transformations" on, say, a million clients.

Of course you can. It's a subset of the same computation, you're just doing it in a different place.

> Somehow in your world audit logging doesn't exist.

If you have to use a separate "audit logging" datastore to augment your relational database then I think you've proven my point.

replies(2): >>dmitri+Yj >>eklavy+em
◧◩◪◨⬒
11. KptMar+7h[view] [source] [discussion] 2021-11-26 12:17:08
>>lmm+0c
That's seriously one of the worst takes I've seen on this website.

>the attempt to charge is recorded in a leger

Hint: how do you think this attempt is recorded and fulfilled? Or, do you think "it's just appended" and bank recalculates your balance from scratch every time you spend 1$ on coke can?

Only bank I've heard of that's not using traditional relational database for ledger is Monzo [1] - but they still use Cassandra's transactions.

[1] https://www.scaleyourapp.com/an-insight-into-the-backend-inf...

replies(1): >>lmm+4i
◧◩◪◨⬒⬓
12. lmm+4i[view] [source] [discussion] 2021-11-26 12:27:03
>>KptMar+7h
> Hint: how do you think this attempt is recorded and fulfilled? Or, do you think "it's just appended" and bank recalculates your balance from scratch every time you spend 1$ on coke can?

That's how the bank I worked with did it. Of course there was caching in place so we didn't actually recompute everything every time, but the implementation of that was a lot closer to "commit a kafka offset" than an RDBMS-style transaction. (E.g. we didn't overwrite the "current balance" in-place, we appended a new "current balance as of time x").

replies(2): >>dmitri+4k >>johnth+sK1
◧◩◪
13. Ma8ee+ai[view] [source] [discussion] 2021-11-26 12:28:10
>>lmm+f9
> But making the current state the primary thing is a huge step backwards

Yeah, who could need to know exactly how many items of a particular product they have in stock currently, or how much money a customer has in her account at the particular moment she wants to do a withdrawal? It's really hard to come up with any useful real world examples when this could be the case.

> What do you do when a transaction fails?

It depends on why the transaction fails and in which way. But sometimes it is really useful to make sure that when one account is debited, another one is credited at the same time.

replies(1): >>lmm+jV6
◧◩◪◨⬒⬓⬔
14. dmitri+Yj[view] [source] [discussion] 2021-11-26 12:44:02
>>lmm+3h
> > No, it won't. Because you won't be able to run "a corresponding set of transformations" on, say, a million clients.

> Of course you can.

Of course, you can't. Because you can't run a million transformations. Whereas querying specific data for any of the one million clients? It's trivial on a relational database.

Moreover. If you need new queries into data, it's again trivial. Because you have the current view of your data, and you don't need to recalculate everything from the beginning of time just because your requirements ever so slightly changed.

> If you have to use a separate "audit logging" datastore to augment your relational database then I think you've proven my point.

No, I haven't.

It's funny, however, that you think that businesses don't require a current view of data and need to re-calc everything from scratch.

◧◩◪◨⬒⬓⬔
15. dmitri+4k[view] [source] [discussion] 2021-11-26 12:44:45
>>lmm+4i
> Of course there was caching in place so we didn't actually recompute everything every time

I think you've proved our point

◧◩◪◨⬒⬓⬔
16. eklavy+em[view] [source] [discussion] 2021-11-26 13:03:44
>>lmm+3h
I would like to disagree, in my experience eventing/cqrs are wonderful solutions to a set of problems (specially where event by event playback is a primary functionality). In most other cases it’s overkill and maintaining a snapshot of state, which like you said is inevitable even in the event log case, is imperative.

There are just too many scenarios where not having transactions is dog slow or really really unwieldy.

replies(1): >>lmm+LV6
◧◩
17. LgWood+Sy[view] [source] [discussion] 2021-11-26 14:51:08
>>dmitri+z7
This is missing the whole point of Kafka consumers, which is to consume data from a topic and do something with it.

One of those things being “store it in a relational model” or “write a sum to a key value store” or something else.

This ability comes for free with Kafka, but is very not-free when using a relational model.

replies(2): >>dmitri+pG >>robert+2Q2
18. 2-718-+nz[view] [source] 2021-11-26 14:54:08
>>lmm+(OP)
you can efficiently do someting with kafka that is equivalent to maintaining relational tables and joining them? seriously?
◧◩◪
19. dmitri+pG[view] [source] [discussion] 2021-11-26 15:40:52
>>LgWood+Sy
> This is missing the whole point of Kafka consumers

It's not missing that because it doesn't even address that. I'm answering a specific point.

◧◩◪◨⬒
20. marcos+fL[view] [source] [discussion] 2021-11-26 16:14:16
>>lmm+0c
The reason the things are called "transactions" is because they were invented for banks. Bank ledgers must always be appended in pairs or not at all, never in any other number. The entire finance system is dependent on that feature.

Transactions were kept by humans, literally for a few centuries, before the algorithm was adapted for computers.

replies(1): >>lmm+sU6
◧◩◪◨⬒⬓⬔
21. johnth+sK1[view] [source] [discussion] 2021-11-26 23:09:25
>>lmm+4i
every large ingest app i have worked on had something akin to kafka, from raw 3d seismic broadcast via sat, to RF tower motion detection, to carrier grade cellular billing. common denominator was a replayable ingest queue. yes, kafka is a "great" idea. however, it is not a replacement for querying.
◧◩◪
22. robert+2Q2[view] [source] [discussion] 2021-11-27 11:47:26
>>LgWood+Sy
They were answering this statement:

> Relational database seem to be a crazily overengineered solution in search of a problem

Why would an answer to that need to mention Kafka consumers?

replies(1): >>LgWood+BH6
◧◩◪◨
23. LgWood+BH6[view] [source] [discussion] 2021-11-28 23:19:38
>>robert+2Q2
* When all you need is an unbounded stream of data that you need to traverse in order to do all these things.*

This is the part I was responding to.

replies(1): >>robert+Oa8
◧◩◪◨⬒⬓
24. lmm+sU6[view] [source] [discussion] 2021-11-29 00:58:46
>>marcos+fL
RDBMS "transactions" work nothing like banking transactions; when you abandon a banking transaction you don't erase it as though it never happened, you keep a full record of what happened but the downstream consequences change. In fact the way traditional accounting is done, with transactions first committed to journals and then later asynchronously propagated into ledgers, is more closely akin to how Kafka-based systems work.
◧◩◪◨
25. lmm+jV6[view] [source] [discussion] 2021-11-29 01:06:22
>>Ma8ee+ai
> Yeah, who could need to know exactly how many items of a particular product they have in stock currently, or how much money a customer has in her account at the particular moment she wants to do a withdrawal? It's really hard to come up with any useful real world examples when this could be the case.

Having access to the current state of the world is useful, having a log of what happened / how it got that way is essential. You've got to get the foundations right before you build a monumental edifice on top.

◧◩◪◨⬒⬓⬔⧯
26. lmm+LV6[view] [source] [discussion] 2021-11-29 01:10:12
>>eklavy+em
In my experience when you do something that requires transactions - i.e. some complicated calculation based on the current state of the world that you can't reduce to a sequence of events and transformations between them - you always end up regretting it. Almost by definition, you can't reproduce what the transaction was supposed to do, and if there are bugs in your logic then you can't fix them; often you can't even detect that they happened.
◧◩◪◨⬒
27. robert+Oa8[view] [source] [discussion] 2021-11-29 14:01:16
>>LgWood+BH6
You're talking about "putting a snapshot of the data somewhere" - the person you're replying to is replying to someone who says this sort of snapshot is pointless.
[go to top]