HNHacker News
TopNewBestAskShowJobs

oskar_dudycz

163 karma · joined January 13, 2021

submissionscomments
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
You can check more in those sources: - https://techcrunch.com/2019/01/09/aws-gives-open-source-the-... - https://news.ycombinator.com/item?id=18871483 - https://www.enterprisedb.com/blog/documentdb-really-postgres...

TLDR: AWS didn't want to pay for licenses and rolled out their own thing.

oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Thank you! I'm planning to add support to JSON schema and run the validation upon insert/update operation.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Not yet, but it's a nice idea. I added GH issue to track that: https://github.com/event-driven-io/Pongo/issues/13
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
"Great mind think alike" B-)
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
There are, but indeed they're a bit painful to index correctly. I'm planning to add in the future Generated Columns https://www.postgresql.org/docs/current/ddl-generated-column... to give option to extract part of the json as regular column.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Yes, a similar idea, but I don't aim to be 100% MongoDB compliant or full replacement. My goal is to use as many of PostgreSQL features as possible. Having the library level as translation will allow more scenarios like, e.g. sharing connection and using PostgreSQL hosting.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Thanks, that's the goal: to bring the solid and verified approach in Marten to Node.js land. The concept is similar, but the feature set will be different.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Fair, I'll redraw it ;)
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Good call! I added such a section: https://github.com/event-driven-io/Pongo?tab=readme-ov-file#.... I'd be interested in your thoughts on it.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
You can check Marten, that I was co-maintaining: https://martendb.io/. It doesn't have MongoDB-compliant API, but it's mature, stable and efficient.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Yes to "The posted project looks like a client that connects to pg but behaves like Mongo, where Ferret is a server that accepts Mongo client connections and uses pg as backend storage."
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
I'm planning to add methods for raw JSON path or, in general, raw SQL syntax to enable such fine-tuning and not need to always use MongoDB API. I agree that for many people, this would be better.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
<3
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
I'm planning to add possibility to use Generated Columns in the future https://www.postgresql.org/docs/current/ddl-generated-column... to allow more optimisations.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Yup, I might not reach full compliance, but I will try to follow the Pareto principle. Thanks for the link and kind feedback!
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Thank you!
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Hint: I'm an ex-Marten maintainer, so the similarity is not accidental ;)

As Op said, not needing to rewrite applications or using the muscle memory from using Mongo is beneficial. I'm not planning to be strict and support only MongoDB API; I will extend it when needed (e.g. to support raw SQL or JSON Path). But I plan to keep shim with compliant API for the above reasons.

MongoDB API has its quirks but is also pretty powerful and widely used.

oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Yes, as long as database has support to JSONB and JSON path syntax (so PG 12 >= compliant) you should be good to go :)
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Thanks, I'll try to cover that, good call!
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
I did not, but I'm not using any fancy syntax so far besides JSONB operators. If it won't work, then I'm happy to adjust it to make it compliant.
oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Yes, I'm using JSONB underneath and translating the MongoDB syntax to native queries. As they're not super pleasant to deal with, then I thought that it'd be nice to use some familiar to many MongoDB API.

Regarding IDs, you can use any UUID-compliant format.

oskar_dudycz··on Mongo but on Postgres and with strong consistency benefits
Yes, I'm using MongoDB API in Pongo to keep the muscle memory. So, it's a library that translates the MongoDB syntax to native PostgreSQL JSONB queries.
oskar_dudycz··on Event Sourcing Is Hard (2019)
I wrote the summary of my thoughts on this article: https://event-driven.io/en/event_streaming_is_not_event_sour...
oskar_dudycz··on Event Sourcing Is Hard (2019)
Thanks for answering! The bar is as I described. The events are the source of truth, only if you're using them in the write model as a basis for the state rehydration. If you're using materialised view, even though it's built based on events, then you outsourced the truth to other storage. If you're doing a pattern that you're just using events to build up the materialised view you use for the write model logic, that can lead to using Event Streaming tools like Kafka, Pulsar, etc. And, as you said, this is a dead-end. Read more on what I mean by getting the state in Event Sourcing system: https://event-driven.io/en/how_to_get_the_current_entity_sta...

Of course, rebuilding a state from events each time you're processing command may sound dubious. Still, event stores (even those with relational DBs as backing storage) are optimised to read events quickly. Typically, reading event 100 events are not an issue for them. Also, for a typical LoB application. The temptation to use Snapshots is strong, but it should be treated as an optimisation when there is huge performance requirements. They may get out of sync with events. They may be stale, etc. I wrote about that in: https://www.eventstore.com/blog/snapshots-in-event-sourcing. The critical part is to keep streams short. That's again a difference between Event Streaming and Event Sourcing. In Kafka, you may not care how long your topic is, as it's just a pipe. Event stores are databases, so the more events you have, the worse. It impacts not only performance but also makes schema versioning harder (more on that: https://event-driven.io/en/how_to_do_event_versioning/).

It's easy to fall into the trap, as using a streaming solution is tempting. They promise a lot, but eventually, you may end up having issues as you described.

Still, that can be said on any technology. Event Sourcing has some dark parts. Also, it's essential to highlight them, but it's dangerous to present other tools and patterns issues related to ES.

Event Sourcing by itself doesn't directly relate to eventual consistency, type of storage, messaging, etc. Those are implementation details and tradeoffs we're chosing. Each storage solution has it's patterns and anti-patterns. Relational databases have normalisation. Document databases are denormalised. Key-value stores have strategies for key definition. Event stores also have their specifics. The most important is (as I mentioned) to take into the account the temporal aspect of streams, so keeping them short. I agree that there is a huge gap missing in knowledge sharing. I'm working on the article recently about that aspect. Here's a draft: https://github.com/EventStore/blog-articles/blob/closing-the....

I think that you highlighted well what can happen if you use the Event Streaming solution as a basis for the Event Sourcing solution. But unfortunately, the title and description state that it's about Event Sourcing, which is unfortunate, as it's highly misleading for people who are not aware of what Event Sourcing is and may suggest that it's much more complicated than it's in reality.

See also my other comments below in the thread, where I commented also in more details on other parts.

oskar_dudycz··on Event Sourcing Is Hard (2019)
Did you read my article that I linked, or my initial explanation of the Event Sourcing flow?
oskar_dudycz··on Event Sourcing Is Hard (2019)
They're not mutually exclusive, but they're orthogonal. They're different patterns that happen to integrate with each other. Event Sourcing is about durable state stored and read as event, Event Streaming is about moving events from one place to another.

Event stores can integrate with the streaming platforms, to publish events and move them forward. Most of them have even built-in implementation of the Outbox Pattern that allows to publish events. They're usually called subscriptions. They can be used to build read models or triggers other flows, or route events to streaming platforms.

The essential point is that for read models, you don't expect to have the same guarantees as for write models. It's fine to be facing idempotency, even out of order, as read models shouldn't be used (in general) for business logic validation. In Event Streaming, or models are stale. In Event Sourcing, write model is not stale, you can be sure that you're making a decision on the current state. Thus, most of the points mentioned in the article, are just from struggles to use event streaming solution as tools for storing events. Which is not the issue of Event Sourcing or event stores per se, but using the wrong tool for the job.

oskar_dudycz··on Event Sourcing Is Hard (2019)
Could you elaborate, I think that I'm missing your point.
oskar_dudycz··on Event Sourcing Is Hard (2019)
I think that they were just building the stale read models, and used them as the write model, which created the whole confusion. Regarding the sharing events between module, it's one of the most common and the most dangerous mistakes. It's a leaking abstraction that will eventually create a distributed monolith. It has only downsides of monolith and microservices, without the upsides. I wrote longer on the topic of internal and external events, and how to model them: https://event-driven.io/en/events_should_be_as_small_as_poss...
oskar_dudycz··on Event Sourcing Is Hard (2019)
There is a Slack channel: https://join.slack.com/t/ddd-cqrs-es/shared_invite/zt-m3vf3a...
oskar_dudycz··on Event Sourcing Is Hard (2019)
Could you provide an exact quote? I haven't been able to find any usage of "populate". I found:

`the raw event stream subscription setup kills the ability to locally reason about the boundaries of a service.`

`you have to talk to the people who will be consuming the events you produce to ensure that the events include enough data for the consuming system to make a decision`

`wire a fleet of services together via an event stream`

etc.

Plus the drawing that's at the beginning.

This clearly states that the author doesn't understand what's Event Sourcing and tells about Event Streaming. Event Streaming means:

1. Producer pushes/produces/publishes an event to the queue. In this sense, an event stream is a pipe where you put an event at the end and read it on the other side.

2. Then, you have a set of subscribers that can react to those events. The reaction may be triggering the next step of the workflow. It might also be updating the read model state. That happens with eventual consistency. You also cannot guarantee atomicity or optimistic concurrency, as tools like Kafka doesn't support it. As they were not originally built for. They let you effectively publish and subscribe to the messages.

3. Because of that, if you want to have the write model materialised from an event (or even "populated"). Then you don't have any guarantee if it's stale or not. You need to fight with out of order messages and idempotency. Thus all of those issues that are described in the article.

I'm sorry to say, but the author used the wrong tool for the wrong job. If this article be titled "Event Sourcing is hard if you're confusing it with Event Streaming" then it'd be an excellent article. But, in its current shape, it's just misleading and making the wrong point, repeating just common misunderstandings.

You can read more in:

- https://domaincentric.net/blog/eventstoredb-vs-kafka

- https://www.eventstore.com/event-sourcing

Page 1 of 2Next →