Earlier quoted context omitted.
I work on a bog standard ERP that was originally CRUD, but a whole module was refactored to event sourcing so clients could have a log and rollback. A couple of months back, a QA review reported a bug - the log system didn’t work. Turns out it’s never worked. Nobody has ever done a rollback either.
I understand this thread is about dumping on ES... However, I must notice in your case it was an audit log. An ES system wouldn't work at all without access to events.
The Reactive Monolith – How to Move from CRUD to Event Sourcing
71–80 of 112 posts
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#72And then you realize that the CRUD db you moved away from operates on event sourcing (WAL) anyway. And thus you’re just doing inner platform effect.
The problem is that the CRUD is only recording "What" change/mutation was done, but not "Why" by "Whom", and "When" it was done. With tailing WAL / CDC you can also capture the "When".
This can be partially mitigated by adding audit fields like:
Why (reason for change):
created_bc ("because") / created_reason (a person opened an a/c, a new baby born, or a record was migrated from another datastore)
updated_bc ("because") / updated_reason (fixed typo in the address, or moved to new address)
deleted_bc ("because") / deleted_reason (closed an a/c, an end-user died, GDPR request, soft-deleted, removed by moderator, etc.)
By Whom (i.e. user_id, support person, decision maker, etc.):
created_by
updated_by
deleted_by
When (event time) - with CDC you can capture all the intermediate updated_at events:
created_at
updated_at
deleted_at
This captures much more information that a typical CRUD, but it will only save last update_xxx fields, so it still loses a lot of information.Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#73Ironically I went on to use a lot of ES prinicpals in building a distributed deduplication engine for my previous startup after I left that company. We used a WAL which we were able to rebuild databases/projections from, ship to replica nodes for read replicas, push to S3 for resilient storage etc. it was an extremely powerful architecture for us. It was also complex and required a special skill set to work on and reason about.
I have to imagine anyone that advocates for "moving from CRUD to Event Sourcing" has recently been sucked into drinking the coolaid, and has no idea about the world of hurt they've signed up for, completely necessarily.
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#74I would like to see answers to the question: why move from Crud to event sourcing. Because I have seen at least 5 moderate projects trying to integrate ES. They all failed in the sense that either people didn't understand the code anymore, huge integration times, performance issues and even complete project cancellation because of all people walking away
But if you have the luxury to do consistent CRUD with a relational/graph, ACID database, then a temporal data model might give you much more leverage.
Essentially you think of your records as bookkeeping entries and go from there. You retain the ability to do ad-hoc relational queries, while not having to build core database functionality yourself.
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#75My first experience with event sourcing was having a new hire at a previous company try to shill it. It was a smaller company and he had previously built a career consulting on ES. Every problem we had he would come up with an argument for why ES would solve it. I soon learned he had zero technical ability, but was great at sounding credible to management. I liked to imagine him as a "seagull ES" practitioner. He fli…
The business eventually failed to due to this, due to slow implementation of simple features and many other issues with it.
I will never use ES due to this project, it's pointless, anything you can do with it, you can do without it.
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#76This article doesn’t really explain event sourcing and some of the trade offs with event driven architecture in general (additional complexity). I’ve heard Git is an example of event sourcing. It has all the info for you to be able to determine the current state from scratch if you needed to. I’m not sure why you’d see event sourcing as the next stage of evolution for a CRUD system.
The industry is moving chaotically and sometimes getting stuck in a local minima for a decade. The innovation follows diffusion model, and it slowly builds momentum until the tipping point is reached.
So I do agree, that CQRS/ES might be the next informal industry standard, but we do need tooling, best practices, use cases and success stories.
Maybe we need a special programming language, a DSL, or a framework for it, or a special DBMS.
Another point: it's not that easy to build a correct, scalable and maintainable moderate-complexity CRUD app. Anything beyond a simple blog engine or TODO list tutorial can quickly become a mess. The tutorials are omitting error handling, and that where the juniors are learning from.
Last anecdotal datapoint: when building a moderate-complexity CRUD app, and trying to handle all edge cases/error handling/correctness, I realized that I'm building a poor man's CQRS, so I might do the real thing as well.
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#77Earlier quoted context omitted.
It's not practical. That's why all the arguments for it involve overstating and hyperbole. The results speak for themselves. It's shit.
The question is whether it’s not practical because it hasn’t received the three decades of engineering that relational databases have, or because it’s broken in theory.
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#78Earlier quoted context omitted.
Here's why I used event sourcing. We were modeling well dynamics. And to calculate interesting properties of the well we needed sensor data, the previous state of the well, and a model of the well built by a petroleum engineer. Unfortunately the model of the well wasn't always up to date (pump was replaced, etc..), so we needed to be able to replay all of the sensor data into the well when a model was retroactively c…
it sounds pretty straightforward to implement with basic crud too, though. you'd just need an inserted timestamp field so that you can rerun the analysis with where inserted >= the_date order by inserted
if you use a timeseries databases like kdb+/q, TimescaleDB, InfluxDB, QuestDB, etc., you don't even need to order by the insertion timestamp.
Unlike RDBMS/SQL where rows/tuples are unordered, in timeseries databases they're usually ordered by the insertion time, more similar to dataframes than to SQL tables.
--
[1] Martin Kleppmann — Event Sourcing and Stream Processing at Scale
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#79also, ALWAYS have aggregate's snapshot. never rebuild aggregate from ES unless you are rebuilding your entire system. i always use indices for my snapshots, that way i can work with them just like with any other entity with the difference being the serialized form of the entity itself. it saves a lot of time and makes working with them no different than crud style of sql storage.
Re: The Reactive Monolith – How to Move from CRUD to Event Sourcing
#80I used to be really excited about event sourcing but yeah, its usually just over-engineering. It appeals to the nerd in me because its a powerful & clean model - events are immutable, your entire database can theoretically be reconstructed at any point in time by just replaying an event log up to time X. In the ideal form its sort of the highest fidelity version of data storage, throwing nothing away, supporting all…