Live data from Hacker News

EventStore: Open-Source, Functional Database with Complex Event Processing in JS

github.com

31–40 of 64 posts

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#31
post #25

I do event sourcing in my company and we had a look at this when we started out 4 years ago. What I don't understand is why build a database? Why not build something in the application layer that uses your fav database as a storage mechanism instead? Aren't the existing databases more mature and better to use?

I've used a MySQL table `event_store` with fields `uuid`, `playhead`, `payload` and `recorded_on`; works fine.

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#32
post #25

I do event sourcing in my company and we had a look at this when we started out 4 years ago. What I don't understand is why build a database? Why not build something in the application layer that uses your fav database as a storage mechanism instead? Aren't the existing databases more mature and better to use?

There are a lot of non-trivial aspects to scaling event sourcing systems. Particularly if you want atomicity or asynchronous two-phase committing. Having implemented them ~5 different ways for different services at my startup, I’d definitely welcome a reliable DB-level abstraction.

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#33
post #17

I've had to break it to my client that had built a CRUD application using CQRS and Event Sourcing that they have wasted a huge amount of resources on a misguided architecture. A rewrite is pending.

Why doesn’t it work for the use case?

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#34
post #25

I do event sourcing in my company and we had a look at this when we started out 4 years ago. What I don't understand is why build a database? Why not build something in the application layer that uses your fav database as a storage mechanism instead? Aren't the existing databases more mature and better to use?

I've used a MySQL table `event_store` with fields `uuid`, `playhead`, `payload` and `recorded_on`; works fine.

How did you manage horizontal scaling with this approach?

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#35
post #25

I do event sourcing in my company and we had a look at this when we started out 4 years ago. What I don't understand is why build a database? Why not build something in the application layer that uses your fav database as a storage mechanism instead? Aren't the existing databases more mature and better to use?

I've used a MySQL table `event_store` with fields `uuid`, `playhead`, `payload` and `recorded_on`; works fine.

Good to know. Was thinking of this for myself in a simple usecase.

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#36
post #25

I do event sourcing in my company and we had a look at this when we started out 4 years ago. What I don't understand is why build a database? Why not build something in the application layer that uses your fav database as a storage mechanism instead? Aren't the existing databases more mature and better to use?

There are a lot of non-trivial aspects to scaling event sourcing systems. Particularly if you want atomicity or asynchronous two-phase committing. Having implemented them ~5 different ways for different services at my startup, I’d definitely welcome a reliable DB-level abstraction.

Also putting that abstraction in the app layer allows developers to break it. Either by accident, or as a temporary hack that never gets fixed, or a temporary hack that has unforeseen side effects.

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#37

Earlier quoted context omitted.

I've used a MySQL table `event_store` with fields `uuid`, `playhead`, `payload` and `recorded_on`; works fine.

How did you manage horizontal scaling with this approach?

You could shard based on uuid, so that each shard has its set of objects that it manages.

The easiest way would be to cast uuid as a 64bit unsigned int, then mod by the number of shards. If the number of shards is dynamic, then use consistent hashing.

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#38
post #10

What's it good at? What is this the right tool for?

Persisting a log of events. Used with CQRS and event-sourcing to decouple the Read model(s) from the Command layer for benefits like: multiple read models (projections), time-travel and audit-ability (rebuild the read model to certain point in time), and decoupled contexts. Event-sourcing can be a really useful tool in many domains, but especially where having a state-of-the-art audit log is helpful.

In the parlance of Domain-Driven Design, every aggregate (think object instance as a loose equivalence) is its own stream of events. Loading aggregates involves replaying events until you are caught up.

The key design requirement here is to deeply understand the reads your application will need to perform.

The downsides are you have to push the data somewhere else to digest and report on it. Relations are tough to model, too, as events that happen to more than one aggregate essentially have to repeat the data in each stream in the form appropriate to that domain entity. (You can often model this as one event causing another. Projections work less well for this circumstance.)

This can make it hard to draw data from the underlying store. Instead you must "hydrate" it into objects in memory to ask questions of it, though projections can help. EventStore is definitely not the right choice if you need ad hoc query capability. (I used EventStore in production for 2 years with F#.)

I'd classify this as an exotic data store. Use it if you have a really strong need for event-sourcing. Me... I'd likely choose Datomic instead.

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#39
post #16

I've played around recently with a Redux inspired frontend architecture where the complex, nested reducers are replaced with a single one that simply adds every action to an immutable linked list (i.e, `(state, action) => ({state, action})`. This means all the business logic that would normally live in reducers can be moved over to memoized selectors, which fixes the awkward difference in how reducers and selectors a…

I wrote a similar comment before, viewing redux as a realization of the event sourcing pattern: https://news.ycombinator.com/item?id=17061827 You can go even further and use the exact same "events" or "actions" for event sourcing on the server side too. You just need to save the list of actions to the server. This lets you do realtime sync and multiplayer really easily!

Yeah good connection there. The Redux chrome plugin does indeed show a log of actions and you can rewind through time.

That's another nice way of doing things that way, better diagnostics eh?

Re: EventStore: Open-Source, Functional Database with Complex Event Processing in JS

#40
post #18

Earlier quoted context omitted.

This mirrors exactly the way I've been approaching redux recently as well following the same realization. I feel like this is much cleaner and easier to reason about.

Hi, I'm a Redux maintainer. Got any examples of this? Also, how do you feel it's better than a typical Redux app setup?

It seems like the main difference with a reducer is that the reducer just returns `state`, not `(state, action)`. I'm reading this for the first time but that's how I'm reading it.

But y'all must be storing this `(point-in-time-state, action-that-produced-state)` somewhere, because the Redux Chrome plugin displays this data. Was I wrong in thinking the Chrome plugin was just visualizing data already stored by Redux?

Post reply on HN