秋季创作者更新性能问题
Fall creators update performance issues
在最近的 Windows 10 更新(Fall Creators Update)之后,我们的 .NET c# 4.0 应用程序的性能下降了很多。我认为存在各种问题,其中之一是 log4net(或磁盘 IO)。
我们的应用程序非常复杂(各种 WCF 应用程序和一个 ASPNET MVC 3.0 应用程序)并且在开发过程中有很多 log4net 痕迹。在启动时加载第一页持续 4 或 5 分钟,在更新持续一分钟之前,如果我停用 log4net 性能。
我用两个克隆的虚拟机做了一个测试,在正则表达式操作后记录,差异很明显。
代码:
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);
}
我已经用 log4net 1.2.1 和 2.0.8 进行了测试:
更新前平均 -> 总耗时:600 毫秒
更新后平均 -> 总耗时:1000 毫秒
这对我们来说是一个很重要的问题,我还没有在网上找到任何信息。
-- 更新--
我在 Whosebug 上发现了另一个(未回答的)话题:
log4net became very slow with caller location information after Windows 10 Fall Creators Update (1709)
我已经 运行 对两种环境进行了磁盘基准测试,read/write 速率没有显着差异。
我已经测试了完全禁用 log4net 的应用程序(log4net 阈值="OFF"),现在时间非常相似,所以,正如@DalmTo 评论的那样,有很多可能性是由于 log4net,我会尝试在那里提出一个问题,尽管已经有一个相关的微软问题:https://connect.microsoft.com/VisualStudio/feedback/details/3143189/after-installing-windows-10-1709-update-creating-a-stacktrace-class-has-become-a-magnitude-slower
您可能会遇到此问题:
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.
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.
安装最新的 .NET 4.7.1 可靠性更新 (KB4054856) 应该可以解决这个问题。
- Windows 10 个 Fall Creators 需要 KB4058258 - https://support.microsoft.com/en-us/help/4058258
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.
在最近的 Windows 10 更新(Fall Creators Update)之后,我们的 .NET c# 4.0 应用程序的性能下降了很多。我认为存在各种问题,其中之一是 log4net(或磁盘 IO)。
我们的应用程序非常复杂(各种 WCF 应用程序和一个 ASPNET MVC 3.0 应用程序)并且在开发过程中有很多 log4net 痕迹。在启动时加载第一页持续 4 或 5 分钟,在更新持续一分钟之前,如果我停用 log4net 性能。
我用两个克隆的虚拟机做了一个测试,在正则表达式操作后记录,差异很明显。
代码:
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);
}
我已经用 log4net 1.2.1 和 2.0.8 进行了测试:
更新前平均 -> 总耗时:600 毫秒
更新后平均 -> 总耗时:1000 毫秒
这对我们来说是一个很重要的问题,我还没有在网上找到任何信息。
-- 更新--
我在 Whosebug 上发现了另一个(未回答的)话题: log4net became very slow with caller location information after Windows 10 Fall Creators Update (1709)
我已经 运行 对两种环境进行了磁盘基准测试,read/write 速率没有显着差异。 我已经测试了完全禁用 log4net 的应用程序(log4net 阈值="OFF"),现在时间非常相似,所以,正如@DalmTo 评论的那样,有很多可能性是由于 log4net,我会尝试在那里提出一个问题,尽管已经有一个相关的微软问题:https://connect.microsoft.com/VisualStudio/feedback/details/3143189/after-installing-windows-10-1709-update-creating-a-stacktrace-class-has-become-a-magnitude-slower
您可能会遇到此问题:
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.
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.
安装最新的 .NET 4.7.1 可靠性更新 (KB4054856) 应该可以解决这个问题。
- Windows 10 个 Fall Creators 需要 KB4058258 - https://support.microsoft.com/en-us/help/4058258
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.