EventStoreDB is an event sourcing database that stores your critical data in streams of immutable events. It was built from the ground up for Event Sourcing and offers an unprecedented solution for building event-sourced systems. It offers a low-level protocol in the form of an asynchronous TCP protocol that exchanges protobuf objects. Protobuf is a binary data-interchange format developed by Google, while JSON is the human-readable data-interchange format.
Event Sourcing is used for storing data as events in an append-only log. Append-only log is a command to change the state of the database shall first be recorded in such log before it is applied to the database. Every change done is represented as an event, and appended to the event log. The current state of an entity can be created by iterating over all events in order of occurrence. Now this protocol has adapters for .NET and the JVM. It also offers an HTTP-based interface, based specifically on the AtomPub protocol.
The system information is sourced from the events. We assume Event Sourcing is mainly for auditing, but this is a limited view, but Event Sourcing is so much more than that.An append-only log is great for auditing. On the other side preparing an audit log, an event-sourced system has a prosperity of information and context stored within that can be valuable to the business. Audit log is a chronological record that has changed without reference. As the context is stored within events, the ‘why’ and ‘when’ of the event are stored implicitly within the event’s data.
What is an event
Events represent facts of information or gathering information that happened in the past. Events are immutable in nature, events can be ignored but not be retracted, Events can be interpreted differently.
Event stream is a Ordered Sequence of events, It is also immutable. Each stream represents a specific object. Why is it called streams because if our system is alive and its ongoing, then it means that if we have a look on our screen any then between the previous look and the current one probably new events were recorded, if in our system no event is recorded then that means that either no one is using the system or have some serious back. So that’s why stream because that’s a continuous flow of events, event stream can be a picture like that so we have timeline and each new event is appended at the end of the event stream.
So even event stream are also immutable we cannot just delete events that happened in the meantime, if we want to revert something then we cannot just modify the stored event or delete it. We need to provide another operation and another result of an event that might look a bit tedious but it’s closer to the real life, because if something happened as i said we can not change it we can only fix it. For example if we are generating an invoice, we can not just remove the invoice and send the new one. we are just sending a correction of a new copy of invoice. Each Stream represents a separate object.
Event sourcing has a wide variety of applications in many fields including finance, logistics, healthcare, retail, government, transportation, video game development and many more.
The name directly comes from the fact that event sourcing events are the source of truth. So all of the other data and other data structures are just derived from the events. We can erase in theory all of those other storage as long as we keep event lock then we can always regenerate them. Event sourcing contains a ordered of our operation so if we have look on the shopping cart.
We are initializing the shopping cart.
We are adding new product.
We are may be removing the product because we decided that we did it by mistake.
Then We added a new product.
At the end we are confirming card.
Nice thing about Event sourcing is that we are able to do time traveling. If we have recorded the sequence of events then we can always go back, So we can just take the events and apply that to the current state and get back to time to see what has happened.
- Multiple hosting options : The server can run on Windows, Linux, and MacOS, both on-premise or in-cloud.
- High availability : EventStoreDB can run as a group of nodes with identical data that is available for writing provided at least half of the nodes are alive and connected.
- Projections : It allow you to react to events as they are written, and to create new events when interesting combinations occur.
- Immutable data store : It stores your data as a series of immutable events. Providing one of the most robust audit log options available (characteristics similar to a blockchain).
- Optimistic Concurrency checks : It supports an optimistic concurrency check on the version of the stream to which events are written.
- Client Interface : There are client SDKs based on the gRPC framework for all major languages and platforms including .NET, Java, Go, Node, and Rust.
- Great Performance that scales : Whereas performance depends on configuration and usage pattern. EventStoreDB have 15,000 writes per second and 50,000 reads per second.
In this blog, we have covered Introduction of eventStoreDB. Now you are ready with the understanding of events, event sorcing, event streams and eventStoreDB. For more, you can refer to the documentation: https://www.eventstore.com/