48

I would like to know what advantages there are to using EventStore (http://geteventstore.com) over implementing event sourcing yourself in a MongoDb.

The reason I ask, is that our company has a number of people that work with MongoDb daily. They don't work with Event Sourcing though. While they are not completely in the dark about the subject, they aren't about to start implementing it anywhere either.

I am about to start a project, that is perfectly suited for Event Sourcing. There are about 16 very well defined events, and about 7 well defined projections. I say "about" because I know there will be demand for more projections and events once they see the product in use.

The approach is going to be API first, with a REST Api that other parts of our organisation are going to consume.

While I have read a lot about Event Sourcing the way Greg Young defines it, I have never actually implemented an Event Sourcing solution.

This is a green field project. No technology restrictions since we are going to expose everything as a REST interface. So if anyone has working experience with EvenStore or Event Sourcing with MongoDb please enlighten me.

Also an almost totally non related question about Event Sourcing: Do you ever query the event store directly? Or would you always create new projections and replay event to populate those projections?

mat-mcloughlin
  • 6,492
  • 12
  • 45
  • 62
Jay Pete
  • 4,123
  • 4
  • 35
  • 51

2 Answers2

60

Disclaimer I am Greg Young (if you cant read my name :))


I am going to answer this question though I believe it will likely get deleted anyways. This question alone for me is a bit odd, but the answers are fairly bizarre. I won't take the time to answer each reply individually but will instead put all of my comments in this reply.

1) There is a comment that we only run on a custom version of mono which is a detail but... This is not the case (and has not been for over a year). We were waiting on critical patches we made to mono (as example threadpool.c to hit their master). This has happened.

2) EventStore is 3-clause BSD licensed. Not sure how you could claim we are not Open Source. We also have a company behind it and provide commercial support.

3) Someone mentioned us going on to version 3 in Sept. Version 1 was released 2 years ago. Version 2 added Clustering (obviously some breaking changes vs single node). Version 3 is adding a ton of stuff including ability to have competing consumers. Very little has changed in terms of the actual client protocol over this time (especially for those using the HTTP API).

What is really disturbing for me in the recommendations however is that they don't seem to understand what they are comparing. It would be roughly the equivalent of me saying "Which should I use neo4j or leveldb?". You could build yourself a graph database on top of leveldb but that would be quite a bit of work.

Mongo in this case would be a storage engine on the event store the OP would have to write him/herself. The writing of a production quality event store is a non-trivial exercise on top of a storage engine if you want to have even the most basic operations.

I wrote this in response to the mailing list equivalent of this question:

How will you do the following with Mongo?:

Write and read events to/from streams with ordering/optimistic concurrency/etc

Then:

Your projections don't want to read from streams in the same way they were written, projections are normally interested in event types and want all events of type T regardless of stream written to and in proper order.

You probably also want for instance the ability to switch live from pushed event notifications to handling pulled information (eg polling) etc.

It would make more sense if Kafka, datomic, and Event Store were being compared.

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
Greg Young
  • 2,513
  • 1
  • 21
  • 13
  • 3
    I know your a big advocate for the right tool and Kafka is more a direct comparison. But where the case above refers to event sourcing I can see people reasoning Mongo because he hasn't defined a lot of complexity with reads. Mongo gives him some play + he doesn't have to think about how his TTL config will play out (or in case of Kafka having to setup ZooKeeper). I had to step back from EventStore due to time and start thinking about Mongo for simple event reads. Meanwhile missing version updates. glad to hear the mono version has moved forward. Looking forward for vNext with MS opening .Net – baseman Jan 06 '15 at 06:02
  • 4
    Thanks for your answer Greg. The project has been postponed, but along with my fellow developers, we looked into it a bit more. Did a tiny prototype, and decided on the EventStore. Not sure where you read that I claim EventStore isn't open source. The fact that it is open source is the reason it is even considered. As for comparing apples and oranges, that would be because I simply didn't know any better. – Jay Pete Jan 31 '15 at 19:26
  • @JayPete I got a notification on this which caused me to come back and see your comment just now. The OSS part of my answer was to the down voted comment not your original question. – Greg Young Sep 12 '15 at 19:12
  • We had pain because we used GetEventStore heavily on virtualized infrastructure (not recomended). That aside I would consider if you will ever need to delete specific events... We came up with a way of introducing a void event to 'remove' the handling of other events (for example ones that jam in processing) but this mechanism was not ideal. – andrew pate May 16 '19 at 08:38
7

Seeing as the other replies don't talk about the tooling or benefits in EventStore and only refer to the benefits of MongoDB I'll chime in. But note that my experience is limited.

I'll start with the cons...

  • There are a lot of check-ins which can lead to deciding which version you are going to actively support yourself. While the team has been solidifying their releases, that they have arrived at version 3 not even 18 months after being released should be an indicator that you have to pull up the version you are supporting for another more recent version (which can also impact the platform you choose to deploy to).
  • It's not going to easily work on every platform (especially if you're trying to move to a cloud environment or a docker based lxc container). Some of this is due to the community surrounding other DBs such as Mongo. But the team seems to have been working their butts off on read/write performance while maintaining cross platform stability. As time presses on I've found that you don't want to deviate too far from a bare-metal OS implementation which this day in age is not attractive.
  • Uses a special version of Mono. Finding support for older versions of Mono only serve to make the process more of a root canal.
  • To make the most of performance of EventStore you really need to think about your architecture. EventStore outputs to flat files and event data can grow pretty quickly. What's the fail rate of the disks are you persisting your data to. How are things compressed? archived? etc. You have a lot of control and the control is geared towards storing your data as events. However, while I'm sure Greg Young himself could quote me to my grave the features that optimize and save your disks in the long term, I'll more than likely find a mature Mongo community that has had experience running into similar cases.

And the Pros...

  • RESTful - It's AtomPub. Is your stream not specific enough? Create another and do http gets till your hearts content. Concerned about routing do do an http forward. Concerned about security put an http proxy in front. Simple!
  • You have a nice suite of tools and UI for testing out and building your projections as your events start to generate new data (eg. use chrome browser as a way to debug your projections... ya they're written with java script)
  • Read performance - Since the application outputs to a flat file you can get kernel level caching and expose them via http in the drop of a hat. Also indexes are across your streams for querying projections against larger data sets (but I really get the feeling index performance will creep up on you over time).

I personally would not use this for a core / mission critical / or growing application! However, if you have a side case for keeping your evented environment interesting then I'd give it go! I personally have to stick to Mongo for now.

baseman
  • 173
  • 1
  • 11