Introduction to EventStoreDB

Reading Time: 5 minutes

Introduction

In this article, we will discuss the database for Event Sourcing i.e. EventStoreDB. EventStoreDB is a database for storing data as a series of events and being able to rebuild the current state of these events. It’s an approach to building applications by focusing on storing the state changes that occur. Projections are a feature that allows you to react to changes in the stream in real-time without needing to scan through all the events. Before proceeding, Let’s look at the core topics like events, event-sourcing, and event streams. Let’s Start…

Event

An event is an occurrence that is significant for the system. An event can be either a user action or a system state change, e.g., the user double-clicks on an icon in the taskbar to launch a new application or the file system crash due to memory exhaustion.

Why do we care about events? Because they help us understand what’s happening in our systems and why it’s happening, which allows us to take appropriate steps toward resolving issues quickly and efficiently (e.g., by adding capacity).

Event Stream

An event stream is a sequence of events, which are immutable and append-only.

Events are not just strings or numbers; they can also be complex objects with properties like timestamps and ids. The EventStream constructor takes in an event object as its argument and returns an EventStream instance that you can use to iterate over all the events in your database.

Event Sourcing 

Event Sourcing is an approach to building applications by focusing on storing the state changes that occur.

This means that you capture every change made in your system, no matter how small or large, and preserve it as part of the database at all times. This can include things like adding new data records, deleting old ones, and even modifying existing ones. It also includes events like when something happened (e.g., added a customer), who did it (e.g., customer’s name) and when it happened (e.g., today at 4pm).

Event Storage is a database for storing data as a series of events and being able to rebuild the current state from these events.

Event Storage is a way of persisting events in a database. It’s similar to Cassandra, RethinkDB, or MongoDB but with one major difference: it’s not meant to be used as a search engine or analytics tool (like HBase) but rather as an event log that can be queried when needed.

EventStore

Event Store is built from the ground up to run on clusters of commodity hardware. Running on Linux using Mono it can run in Docker containers and run on several popular cloud providers. Events can be sent directly from services using .NET or using the client libraries for C#/.NET, HTTP, and Azure Storage Queues.

This means that you get access to all of these features without having to worry about maintaining your own database server infrastructure:

  • NoSQL data persistence – If you need high availability or disaster recovery then Event Store will provide this functionality out-of-the-box;
  • NoSQL query capabilities – You can use standard SQL syntax with Event Store;
  • High throughput writes compared with relational databases (CSVs) – In some cases, this could mean doubling performance compared with CSV files alone;
  • Clustering support – You can scale out by adding more nodes without any change in application logic

EventStoreDB

Event Store is a database server with the capability to store streams of events in sequence. It allows you to efficiently query this data if you need to. The core concept of Event Store is an event stream, a series of events that appear in chronological order under one name, identified by GUID. When you subscribe to an application to read from an EventStore instance, it will receive the latest event using its default throttle policy (typically 1000 milliseconds). This means that when applications access your database they should be able to do so without waiting for their turn at reading data from it.

EventStoreDB is a new way for building real-time apps on top of Kafka Connect API which provides all necessary features such as persistent storage and push notifications without any additional effort or cost!

EventStoreDb is a database server with the capability to store streams of events in sequence, and it allows you to efficiently query this data if you need to. The core concept of Event Store is an event stream, a series of events that appear in chronological order under one name, identified by GUID.

The main benefit that comes from using EventStoreDb as your primary storage mechanism for storing data is that it provides much more flexibility than what other databases offer:

  • No schema definition required – You can create any number of tables within your database as needed; there are no limits on how many tables/fields per table or column size limitations (you don’t have to worry about these things).

Projections

Event Store Database is both an Event Storage database, and a messaging system called Projections.

Projections are a feature that allows you to react to changes in the stream in real-time without needing to scan through all the events. They’re similar to aggregations, but they aren’t limited by what’s stored in your IndexedDB store. They only access your event store when needed, which makes them much faster than normal queries that do not take advantage of projection features (e.g., finding all purchases made within a certain time interval).

Projections are based on time series data, so they’re able to represent changes over time. The projection engine can identify patterns in the incoming stream and then find out how these patterns change over time.

For us humans (or machines) to understand what we see, it is important for us not just to look at one point of view but also compare different points of view together – this way we can get deeper insights into our data and make better decisions based on them!

The Client APIs used 

The HTTP Client API can be used to read, write and subscribe to streams in EventStoreDB.

The HTTP Client API is a RESTful API that consumes data in the form of HTTP requests. The client library contains just one class: EventClientHttp which you’ll use as a wrapper around your TCP listener and provides some convenience functions for working with fields, indexes, and attributes on each record returned by an event stream.

It also includes support for additional features such as batching and pagination.

The TCP Client API can be used to manage streams, read, write and transact with them.

The TCP Client API is a binary protocol that allows you to communicate with an EventStoreDB instance using the standard Java NIO HTTP client. The only requirement for using it is that your application must be able to handle exceptions thrown by the server.

EventStoreDB vs Traditional Database

EventStoreDB provides several benefits over traditional databases, including:

  • Flexibility: The EventStoreDB allows you to add or remove columns without having to change the schema. This allows you to keep your data in one place while still being able to access it from multiple applications.
  • Performance: EventStoreDB handles massive amounts of data with low overhead. This means that it will perform well even when dealing with large files or lots of transactions.
  • Scalability: The EventStoreDB’s flexible architecture means that it can scale out across multiple machines, as well as between different servers and cloud-based storage providers. It also allows for extremely high throughput due to its use of distributed transactions and atomic writes.
  • Easier for users: Storing events and messages as JSON makes them easier for humans to understand than using traditional database methods. It’s easier for the users to query event data since it’s stored as JSON instead of SQL.

Conclusion

In conclusion, we get an Overview of EventstoreDB. Stay tuned.

Read Official Documentation for more knowledge.

Meanwhile, visit Knoldus Blogs to gain more information about different technologies.

Written by 

Kuldeep is a Software Consultant at Knoldus Software LLP. He has a sound knowledge of various programming languages like C, C++, Java, MySQL, and various frameworks like Apache Kafka and Spring/Springboot. He is passionate about daily and continuous improvement.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading