Hi guys, please excuse if my question is too trivial. I’ve only been dealing with Event Sourcing for a day and I’m trying to understand it in the context of EventStoreDb.
In this post by Greg Young it is mentioned that EventStoreDb is designed to handle millions of streams.
I only have experience with traditional message brokers where I maintain one queue per topic and process the messages where are very few queues. Now for EventStoreDB: Let’s say I have an application that creates continuous financial statistics for its users. The user makes an input about a business transaction (emits Event to EventStore), these events would all be stored in a stream (let’s call it “business-activities”).
Since the cost of a stream (see post) is very low. Wouldn’t it make sense to have one stream per user (e.g. “user-business-activities-1235”)? Or does it make sense or should I keep the main “business-activities” stream, get a user_id from the event payload and read all specific user events for further processing?
Pro for main stream:
- Ease of use
- Easy migration by replaying events from the event log to populate the new readmodel tables.
Con for main stream:
- With large numbers of users, the sum of events in the stream increases enormously
Pro for user stream:
- Uncluttered and small sum of events per stream
Con for user stream:
- Increased complexity
- Migrations to a new readmodel requires knowledge about the individual user_ids to iterate over the respective streams.
Thanks a lot!