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