-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Akka.Persistence: improve AsyncWriteJournal
and PersistentActor
performance
#6432
Akka.Persistence: improve AsyncWriteJournal
and PersistentActor
performance
#6432
Conversation
|
Method | PersistentActors | WriteMsgCount | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|---|---|---|
WriteToPersistence | 1 | 100 | 489.1 μs | 44.12 μs | 128.7 μs | 508.1 μs | - | - | 145.61 KB |
WriteToPersistence | 10 | 100 | 1,289.8 μs | 62.97 μs | 175.5 μs | 1,279.5 μs | - | - | 1416.34 KB |
WriteToPersistence | 100 | 100 | 30,953.0 μs | 943.54 μs | 2,722.3 μs | 30,163.0 μs | 2000.0000 | 1000.0000 | 13980.24 KB |
This PR
BenchmarkDotNet=v0.13.2, OS=Windows 10 (10.0.19044.2604/21H2/November2021Update)
AMD Ryzen 7 1700, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.100
[Host] : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2
Job-SDRCEZ : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2
InvocationCount=1 UnrollFactor=1
Method | PersistentActors | WriteMsgCount | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|---|---|---|
WriteToPersistence | 1 | 100 | 521.7 μs | 45.74 μs | 132.0 μs | 535.2 μs | - | - | 147.91 KB |
WriteToPersistence | 10 | 100 | 1,754.9 μs | 210.71 μs | 611.3 μs | 1,580.8 μs | - | - | 1411.19 KB |
WriteToPersistence | 100 | 100 | 29,833.8 μs | 725.73 μs | 2,093.9 μs | 29,651.6 μs | 2000.0000 | 1000.0000 | 13893.84 KB |
Got rid of the value delegates - that seemed to hurt more than help. BenchmarkDotNet=v0.13.2, OS=Windows 10 (10.0.19044.2604/21H2/November2021Update)
AMD Ryzen 7 1700, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.100
[Host] : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2
Job-PWUWVX : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2
InvocationCount=1 UnrollFactor=1
|
Eliminated some additional BenchmarkDotNet=v0.13.2, OS=Windows 10 (10.0.19044.2604/21H2/November2021Update)
AMD Ryzen 7 1700, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.100
[Host] : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2
Job-AKPKTM : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2
InvocationCount=1 UnrollFactor=1
|
@@ -162,26 +168,25 @@ protected override bool AroundReceive(Receive receive, object message) | |||
/// <returns>TBD</returns> | |||
protected override Task<IImmutableList<Exception>> WriteMessagesAsync(IEnumerable<AtomicWrite> messages) | |||
{ | |||
var trueMsgs = messages.ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
work-around for serialization problems caused by the MNTR Cluster.Sharding specs that use this journal impl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
Fixes #5522
@F0b0s has already eliminated a ton of allocations from the journal - I'm addressing some more based on @to11mtm 's feedback.
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):
Latest
dev
BenchmarksInclude data from the relevant benchmark prior to this change here.
This PR's Benchmarks
Include data from after this change here.