Skip to content

Commit 517c3a5

Browse files
authored
Add TOC and benchmark figures to README.md (#384)
1 parent 3a9c080 commit 517c3a5

File tree

1 file changed

+47
-7
lines changed

1 file changed

+47
-7
lines changed

README.md

+47-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
# Akka.Persistence.MongoDB
1+
- [Akka.Persistence.MongoDB](#akkapersistencemongodb)
2+
* [Setup](#setup)
3+
* [Configuration](#configuration)
4+
* [Programmatic configuration](#programmatic-configuration)
5+
* [Serialization](#serialization)
6+
- [Large Snapshot Store Support](#large-snapshot-store-support)
7+
* [Configuring `MongoDbGridFSSnapshotStore`](#configuring-mongodbgridfssnapshotstore)
8+
- [Performance Benchmarks](#performance-benchmarks)
9+
10+
# Akka.Persistence.MongoDB
211

312
Akka Persistence journal and snapshot store backed by MongoDB database.
413

514
> [!NOTE]
6-
>
15+
>
716
> The MongoDB operator to limit the number of documents in a query only accepts an integer while akka provides a long as maximum for the loading of events during the replay. Internally the long value is cast to an integer and if the value is higher than Int32.MaxValue, Int32.MaxValue is used. So if you have stored more than 2,147,483,647 events for a single PersistenceId, you may have a problem :wink:
817
918
## Setup
@@ -133,12 +142,12 @@ akka.persistence {
133142

134143
## Programmatic configuration
135144

136-
You can programmatically override the connection string setting in the HOCON configuration by adding a `MongoDbPersistenceSetup` to the
145+
You can programmatically override the connection string setting in the HOCON configuration by adding a `MongoDbPersistenceSetup` to the
137146
`ActorSystemSetup` during `ActorSystem` creation. The `MongoDbPersistenceSetup` takes `MongoClientSettings` instances to be used to configure
138147
MongoDB client connection to the server. The `connection-string` settings in the HOCON configuration will be ignored if any of these `MongoClientSettings`
139148
exists inside the Setup object.
140149

141-
> [!NOTE]
150+
> [!NOTE]
142151
> The HOCON configuration is still needed for this to work, only the `connection-string` setting in the configuration will be overriden.
143152
144153
Setting connection override for both snapshot store and journal:
@@ -215,9 +224,9 @@ Setting `legacy-serialization = on` will allow you to save objects in a BSON for
215224
MongoDb limits the size of documents it can store to 16 megabytes. If you know you will need to store snapshots larger than 16 megabytes, you can use the `Akka.Persistence.MongoDb.Snapshot.MongoDbGridFSSnapshotStore` snapshot store plugin.
216225

217226
> [!NOTE]
218-
>
227+
>
219228
> `MongoDbGridFSSnapshotStore` is not designed for normal snapshot store plugin, it does not support transaction and read/write operations are slower on this plugin. Only use this plugin if you are having 16 megabyte limit problem.
220-
229+
221230
Note that `MongoDbGridFSSnapshotStore` is considered as advanced optional plugin and it will not get an `Akka.Hosting` support. You will need to use HOCON configuration to use this plugin.
222231

223232
## Configuring `MongoDbGridFSSnapshotStore`
@@ -226,4 +235,35 @@ You will need to override the `class` property of the snapshot store `mongodb` H
226235

227236
```
228237
akka.persistence.snapshot-store.mongodb.class = "Akka.Persistence.MongoDb.Snapshot.MongoDbGridFSSnapshotStore, Akka.Persistence.MongoDb"
229-
```
238+
```
239+
240+
# Performance Benchmarks
241+
242+
```
243+
Windows 10 (10.0.19045.4780/22H2/2022Update)
244+
AMD Ryzen 9 3900X, 1 CPU, 24 logical and 12 physical cores, 64 GB RAM
245+
.NET SDK 8.0.304
246+
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
247+
DefaultJob : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
248+
```
249+
250+
Databases running on Docker for Desktop with WSL2 integration with 10 virtual CPU and 8 GB RAM
251+
252+
All numbers are in msg/sec.
253+
254+
| **Test** | **MongoDB** |
255+
|:----------------|------------:|
256+
| Persist | 257 |
257+
| PersistAsync | 4587 |
258+
| PersistAll | 7322 |
259+
| PersistAllAsync | 30435 |
260+
| PersistGroup10 | 1239 |
261+
| PersistGroup25 | 2290 |
262+
| PersistGroup50 | 3367 |
263+
| PersistGroup100 | 4108 |
264+
| PersistGroup200 | 4404 |
265+
| PersistGroup400 | 3777 |
266+
| Recovering | 30370 |
267+
| RecoveringTwo | 26693 |
268+
| RecoveringFour | 35551 |
269+
| Recovering8 | 44192 |

0 commit comments

Comments
 (0)