Skip to content
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

Logging Benchmarks #6164

Merged
merged 2 commits into from Oct 10, 2022
Merged

Conversation

Aaronontheweb
Copy link
Member

Changes

The Akka.NET logging system fundamentals haven't really changed much since 2014 or so, and I suspect we are doing some extremely ugly things in that code. Adding some benchmarks using a custom ILoggingAdapter implementation so I can measure the overhead.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Latest dev Benchmarks

BenchmarkDotNet=v0.13.2, OS=Windows 10 (10.0.19043.2006/21H1/May2021Update)
Intel Core i7-8850H CPU 2.60GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET SDK=6.0.100
  [Host]     : .NET 6.0.9 (6.0.922.41905), X64 RyuJIT AVX2
  Job-JJNOTA : .NET 6.0.9 (6.0.922.41905), X64 RyuJIT AVX2

InvocationCount=1  UnrollFactor=1  
Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Gen2 Allocated Alloc Ratio
LogInfoNoParams 159.0 ns 3.18 ns 6.42 ns 1.00 0.00 0.0110 0.0040 0.0010 64 B 1.00
LogInfo1Params 663.5 ns 11.04 ns 9.79 ns 4.15 0.20 0.0280 0.0110 0.0030 160 B 2.50
LogInfo2Params 849.3 ns 14.42 ns 12.78 ns 5.31 0.29 0.0340 0.0140 0.0040 192 B 3.00
LogInfoWithException 162.7 ns 3.11 ns 5.99 ns 1.03 0.05 0.0110 0.0040 0.0010 64 B 1.00
LogInfoWithException1Params 669.4 ns 13.36 ns 12.50 ns 4.20 0.21 0.0280 0.0110 0.0030 160 B 2.50
LogInfoWithException2Params 850.4 ns 11.39 ns 10.10 ns 5.32 0.25 0.0340 0.0140 0.0040 192 B 3.00

Bear in mind - these results are scaled down per operation. This means writing a single log event in Akka.NET is roughly 10x more expensive than processing a message by default.

@Aaronontheweb Aaronontheweb added this to the 1.5.0 milestone Oct 10, 2022
@Aaronontheweb Aaronontheweb merged commit b6c5e93 into akkadotnet:dev Oct 10, 2022
@Aaronontheweb Aaronontheweb deleted the strongly-typed-logging branch October 10, 2022 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant