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

NLog configured with async while Serilog isn't #4

Open
saithis opened this issue Oct 14, 2018 · 2 comments · May be fixed by #6
Open

NLog configured with async while Serilog isn't #4

saithis opened this issue Oct 14, 2018 · 2 comments · May be fixed by #6

Comments

@saithis
Copy link

saithis commented Oct 14, 2018

The current code wraps the NLog file target in async, while serilog isn't configured to use async.

If I change the Serilog config to use Serilog.Sinks.Async version 1.3:
.WriteTo.Async(a => a.File("Log.txt"), blockWhenFull: true) // blockWhenFull is true, because NLog is also configured to block when full.
then I get the following results:

Serilog
Stopwatch.IsHighResolution = True

Generated 5000000 values in 13265ms (throughput = 376921,450 ops per second)
Mean latency = 2,525mcs
99% observations less than = 3,923mcs
99.99% observations less than = 136,991mcs
0) 2,112 - 2,2932 = 1786993
1) 2,293 - 2,4743 = 2714479
2) 2,474 - 2,6553 = 0
3) 2,655 - 2,8364 = 355649
4) 2,836 - 3,0174 = 0
5) 3,017 - 3,1985 = 50067
6) 3,198 - 3,3795 = 19338
7) 3,380 - 3,5606 = 0
8) 3,561 - 3,7416 = 21023
9) 3,742 - 3,9227 = 11933
Press any key to stop...
NLog
Stopwatch.IsHighResolution = True

Generated 5000000 values in 13549ms (throughput = 369009,616 ops per second)
Mean latency = 2,552mcs
99% observations less than = 4,526mcs
99.99% observations less than = 1719,028mcs
0) 1,207 - 1,5389 = 1707446
1) 1,539 - 1,8708 = 2642809
2) 1,871 - 2,2027 = 244115
3) 2,203 - 2,5346 = 141062
4) 2,535 - 2,8666 = 74074
5) 2,867 - 3,1985 = 53491
6) 3,198 - 3,5304 = 21560
7) 3,530 - 3,8623 = 14697
8) 3,862 - 4,1942 = 28356
9) 4,194 - 4,5261 = 33534
Press any key to stop...

Dev info

Windows 10 Professional x64
Microsoft Visual Studio Enterprise 2017 15.7.4
.NET Core SDK 2.1.301

Computer infomation

AMD Ryzen 7 1700X
32GB
Samsung Evo 960 M.2 1TB
@snakefoot
Copy link

NLog 4.6 has been released that improves the Async-performance on NetCore:

See also: #1 (comment)

@snakefoot snakefoot linked a pull request Apr 16, 2021 that will close this issue
@snakefoot
Copy link

Created #6 with updated benchmark-results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants