After the recent Windows 10 Update (Fall Creators Update) the performance of our .NET c# 4.0 application had decreased a lot. I think there are various issues and one of them is log4net (or disk IO).
Our application is very complex (various WCF applications and a ASPNET MVC 3.0 app) and in development there are a lot of log4net traces. Loading the first page in startup lasts 4 or 5 minutes and before the updates lasts a minute, If I deactivate log4net the performance.
I've done a test with two cloned virtual machines, logging after a regex operation, and the diferrences are significant.
The code:
static void Main(string[] args)
{
Log.Info("Log4net1");
DateTime start = DateTime.Now;
for (int i = 0; i < 50; i++)
{
DoTheThing();
}
TimeSpan elapsedTime = DateTime.Now - start;
Log.DebugFormat("TOTAL Elapsed time: {0}", elapsedTime.TotalMilliseconds);
Console.ReadKey();
}
private static void DoTheThing()
{
DateTime start = DateTime.Now;
Regex.Replace(TEXT, " nec ", m =>
{
return " (word nec) ";
});
TimeSpan elapsedTime = DateTime.Now - start;
Log.DebugFormat("Elapsed time: {0}", elapsedTime.TotalMilliseconds);
}
I've done tests with log4net 1.2.1 and 2.0.8:
average beforeUpdate -> TOTAL Elapsed time: 600ms
average afterUpdate -> TOTAL Elapsed time: 1000ms
It's a very important issue for us, and I haven't found any info on the net.
-- UPDATE --
I've found another (unanswered) thread on stackoverflow: log4net became very slow with caller location information after Windows 10 Fall Creators Update (1709)
I've ran a disk benchmark on both environments and there's no significant differences on read/write rates. I've tested the application disabling completely log4net (log4net threshold="OFF") and now the timings are very similar, so, as @DalmTo comments, there a lot of possibilities that it would be due to log4net, I'll try to put an issue there, although there is already a related microsoft issue: https://connect.microsoft.com/VisualStudio/feedback/details/3143189/after-installing-windows-10-1709-update-creating-a-stacktrace-class-has-become-a-magnitude-slower
The Fall Creators Update is a major package of new and improved features for Windows 10, and it's completely free. It brings support for Windows Mixed Reality headsets, as well as improved privacy features, better accessibility options and a new interface.
The Windows 10 Fall Creators Update includes additional features and improvements for your Windows 10 phone. To manually check for the update, on Start , swipe over to the All apps list, then select Settings > Update & security > Phone update > Check for updates.
Error code 0x80d02002 is one of them. It usually occurs when you're trying to download a new feature update. Unfortunately, restarting your computer and checking for updates again won't help you fix the problem.
You can also determine if you have the Creators Update by looking at your Windows version by clicking Start, typing in winver and pressing Enter . If you have version 1703 or higher, you have the Creators Update.
You could be hit by this issue:
Starting in October 2017, after you upgrade to Windows 10 Version 1709 or .NET Framework 4.7.1, you notice a significant decrease in performance when you run .NET Framework applications that use the System.Diagnostics.StackFrame class.
Applications typically rely on StackFrame when they throw .NET exceptions. If this occurs at a high rate (more than 10 incidents per second), applications can slow down significantly (tenfold) and run noticeably slower than before.
https://support.microsoft.com/en-us/help/4057154/performance-of-system-diagnostics-stackframe-degrades-in-windows-10-17
The .NET Framework 4.7.1 added support for detecting and parsing the Portable PDB file format to show file and line number information in stack traces. As part of this change, each function in a stack trace has its defining module checked to determine if that module uses the Portable PDB format.
Due to some differences in the internal caching policy, the runtime spends far more time searching for Portable PDBs than previous .NET Framework versions spent searching for classic Windows PDBs. This causes formatted stack traces to be produced more slowly than before.
https://github.com/Microsoft/dotnet/blob/master/releases/net471/KnownIssues/517815-BCL%20Applications%20making%20heavy%20use%20of%20System.Diagnostics.StackTrace%20might%20run%20more%20slowly%20on%20.NET%204.7.1.md
Installing the latest .NET 4.7.1 Reliability Update (KB4054856) should resolve this.
The following fixes are included: Applications making heavy use of System.Diagnostics.StackTrace or Exception.StackTrace might run more slowly on the .NET Framework 4.7.1.
https://blogs.msdn.microsoft.com/dotnet/2018/01/09/net-framework-4-7-1-is-available-on-windows-update-wsus-and-mu-catalog/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With