diff --git a/LoggingPerformance.NLog/LoggingPerformance.NLog.csproj b/LoggingPerformance.NLog/LoggingPerformance.NLog.csproj index ebd3f94..e5d982c 100644 --- a/LoggingPerformance.NLog/LoggingPerformance.NLog.csproj +++ b/LoggingPerformance.NLog/LoggingPerformance.NLog.csproj @@ -2,12 +2,15 @@ Exe - netcoreapp2.0 + net5.0 - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/LoggingPerformance.NLog/Program.cs b/LoggingPerformance.NLog/Program.cs index 67e1843..02ac115 100644 --- a/LoggingPerformance.NLog/Program.cs +++ b/LoggingPerformance.NLog/Program.cs @@ -15,7 +15,7 @@ namespace LoggingPerformance.NLog { internal class Program { - private static int _countPerThread = 5000000; + private static int _countPerThread = 1000000; private static int _producersCount = 1; private static int _totalCount; diff --git a/LoggingPerformance.Serilog/LoggingPerformance.Serilog.csproj b/LoggingPerformance.Serilog/LoggingPerformance.Serilog.csproj index 4cca98c..fd9fb98 100644 --- a/LoggingPerformance.Serilog/LoggingPerformance.Serilog.csproj +++ b/LoggingPerformance.Serilog/LoggingPerformance.Serilog.csproj @@ -2,13 +2,17 @@ Exe - netcoreapp2.0 + net5.0 - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/LoggingPerformance.Serilog/Program.cs b/LoggingPerformance.Serilog/Program.cs index ca8903e..fd9c676 100644 --- a/LoggingPerformance.Serilog/Program.cs +++ b/LoggingPerformance.Serilog/Program.cs @@ -9,14 +9,14 @@ namespace LoggingPerformance.Serilog { internal class Program { - private static int _countPerThread = 5000000; + private static int _countPerThread = 1000000; private static int _producersCount = 1; private static int _totalCount; private static void Main(string[] args) { var log = new LoggerConfiguration() - .WriteTo.File("Log.txt", buffered: true, flushToDiskInterval: TimeSpan.FromMilliseconds(1000)) + .WriteTo.Async(a => a.File("Log.txt", buffered: true), blockWhenFull: true) .CreateLogger(); Log.Logger = log; diff --git a/LoggingPerformance.sln b/LoggingPerformance.sln index 03ac4c6..63757d8 100644 --- a/LoggingPerformance.sln +++ b/LoggingPerformance.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2026 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoggingPerformance.Serilog", "LoggingPerformance.Serilog\LoggingPerformance.Serilog.csproj", "{8C0236B3-A8A7-4D49-84A4-CCBEBBCD0956}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoggingPerformance.Serilog", "LoggingPerformance.Serilog\LoggingPerformance.Serilog.csproj", "{8C0236B3-A8A7-4D49-84A4-CCBEBBCD0956}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoggingPerformance.NLog", "LoggingPerformance.NLog\LoggingPerformance.NLog.csproj", "{5996F906-257C-4C07-91EB-FEFCF8411D09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoggingPerformance.NLog", "LoggingPerformance.NLog\LoggingPerformance.NLog.csproj", "{5996F906-257C-4C07-91EB-FEFCF8411D09}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/README.md b/README.md index ebd8c73..566d16f 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,16 @@ Logging performance comparison between Serilog and NLog. ### Dev info -1. Windows 10 Education x64 -2. Microsoft Visual Studio Enterprise 2017 15.7.3 -3. .NET Core 2.0 +1. Windows 10 Enterprise 64-bit (Build 18363) +2. Microsoft Visual Studio Enterprise 2019 16.8.4 +3. .NET 5 +4. Platform target: 64bit ### Computer infomation -1. Intel i5-7500 3.40GHz -2. 16GB -3. Intel 600P 256G +1. Intel Core i7 8665U @ 1.90GHz +2. 16GB DDR4-2667 (1333 MHz) +3. Seagate FireCuda 520 SSD 1TB ### Involving library @@ -27,82 +28,86 @@ Logging performance comparison between Serilog and NLog. ### Arrange -Write target: File -Test input count: 1000000 -Producer: 1 +Write target: File +Test input count: 1000000 +Producer: 1 ### Serilog -Generated 1000000 values in 3506ms (throughput = 285199.451 ops per second) -Mean latency = 3.474mcs -99% observations less than = 15.624mcs -99.99% observations less than = 125.596mcs -0) 2.404 - 3.7258 = 950441 -1) 3.726 - 5.0479 = 15937 -2) 5.048 - 6.3699 = 2294 -3) 6.370 - 7.6920 = 3218 -4) 7.692 - 9.0141 = 10559 -5) 9.014 - 10.3361 = 1593 -6) 10.336 - 11.6582 = 630 -7) 11.658 - 12.9803 = 705 -8) 12.980 - 14.3023 = 466 -9) 14.302 - 15.6244 = 5128 +Generated 1000000 values in 4541ms (throughput = 220180,668 ops per second) +Mean latency = 4,500mcs +99% observations less than = 10,100mcs +99.99% observations less than = 6068,900mcs + +0) 1,800 - 2,6300 = 453451 +1) 2,630 - 3,4600 = 443718 +2) 3,460 - 4,2900 = 64609 +3) 4,290 - 5,1200 = 10908 +4) 5,120 - 5,9500 = 3786 +5) 5,950 - 6,7800 = 3105 +6) 6,780 - 7,6100 = 2710 +7) 7,610 - 8,4400 = 1313 +8) 8,440 - 9,2700 = 1226 +9) 9,270 - 10,1000 = 5529 ### NLog -Generated 1000000 values in 7256ms (throughput = 137812.554 ops per second) -Mean latency = 7.225mcs -99% observations less than = 434.178mcs -99.99% observations less than = 1055.547mcs -0) 0.901 - 44.2290 = 989657 -1) 44.229 - 87.5566 = 46 -2) 87.557 - 130.8843 = 12 -3) 130.884 - 174.2119 = 230 -4) 174.212 - 217.5395 = 43 -5) 217.540 - 260.8671 = 6 -6) 260.867 - 304.1948 = 1 -7) 304.195 - 347.5224 = 2 -8) 347.522 - 390.8500 = 0 -9) 390.850 - 434.1776 = 5 +Generated 1000000 values in 2532ms (throughput = 394849,270 ops per second) +Mean latency = 2,483mcs +99% observations less than = 3,000mcs +99.99% observations less than = 2006,100mcs + +0) 1,100 - 1,2900 = 229206 +1) 1,290 - 1,4800 = 610634 +2) 1,480 - 1,6700 = 4284 +3) 1,670 - 1,8600 = 31350 +4) 1,860 - 2,0500 = 62533 +5) 2,050 - 2,2400 = 32473 +6) 2,240 - 2,4300 = 10990 +7) 2,430 - 2,6200 = 4577 +8) 2,620 - 2,8100 = 2385 +9) 2,810 - 3,0000 = 2084 # Benchmarks 2 ### Arrange -Write target: File -Test input count: 5000000 -Producer: 1 +Write target: File +Test input count: 5000000 +Producer: 1 ### Serilog -Generated 5000000 values in 17053ms (throughput = 293191.681 ops per second) -Mean latency = 3.381mcs -99% observations less than = 15.324mcs -99.99% observations less than = 120.789mcs -0) 2.404 - 3.6958 = 4746369 -1) 3.696 - 4.9878 = 97342 -2) 4.988 - 6.2798 = 7559 -3) 6.280 - 7.5718 = 6611 -4) 7.572 - 8.8638 = 58916 -5) 8.864 - 10.1559 = 10432 -6) 10.156 - 11.4479 = 3673 -7) 11.448 - 12.7399 = 1609 -8) 12.740 - 14.0319 = 1525 -9) 14.032 - 15.3239 = 19770 +Generated 5000000 values in 21804ms (throughput = 229308,208 ops per second) +Mean latency = 4,322mcs +99% observations less than = 10,300mcs +99.99% observations less than = 6132,500mcs + +0) 1,900 - 2,7400 = 3352251 +1) 2,740 - 3,5800 = 1196751 +2) 3,580 - 4,4200 = 283497 +3) 4,420 - 5,2600 = 38472 +4) 5,260 - 6,1000 = 16407 +5) 6,100 - 6,9400 = 15284 +6) 6,940 - 7,7800 = 8545 +7) 7,780 - 8,6200 = 4784 +8) 8,620 - 9,4600 = 7933 +9) 9,460 - 10,3000 = 31267 ### NLog -Generated 5000000 values in 38294ms (throughput = 130567.331 ops per second) -Mean latency = 7.628mcs -99% observations less than = 462.422mcs -99.99% observations less than = 1126.458mcs -0) 0.901 - 47.0534 = 4947863 -1) 47.053 - 93.2055 = 445 -2) 93.205 - 139.3575 = 825 -3) 139.357 - 185.5095 = 684 -4) 185.510 - 231.6616 = 116 -5) 231.662 - 277.8136 = 29 -6) 277.814 - 323.9656 = 16 -7) 323.966 - 370.1176 = 5 -8) 370.118 - 416.2697 = 1 -9) 416.270 - 462.4217 = 17 \ No newline at end of file +Generated 5000000 values in 12230ms (throughput = 408807,710 ops per second) +Mean latency = 2,397mcs +99% observations less than = 2,600mcs +99.99% observations less than = 1938,000mcs + +0) 1,100 - 1,2500 = 1290664 +1) 1,250 - 1,4000 = 3163826 +2) 1,400 - 1,5500 = 9390 +3) 1,550 - 1,7000 = 17602 +4) 1,700 - 1,8500 = 29994 +5) 1,850 - 2,0000 = 223645 +6) 2,000 - 2,1500 = 245122 +7) 2,150 - 2,3000 = 76199 +8) 2,300 - 2,4500 = 39976 +9) 2,450 - 2,6000 = 12144 \ No newline at end of file