秋季创作者会更新性能问题 [英] Fall creators update performance issues

查看:75
本文介绍了秋季创作者会更新性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最近的Windows 10更新(秋季创作者更新)之后,.NET c#4.0应用程序的性能下降了很多.我认为存在各种问题,其中之一是log4net(或磁盘IO).

我们的应用程序非常复杂(各种WCF应用程序和ASPNET MVC 3.0应用程序),并且在开发中有很多log4net跟踪.在启动过程中加载首页需要4到5分钟的时间,而在更新需要1分钟的时间之前,如果我停用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进行了测试:

平均更新前->总耗时:600ms

更新后的平均时间->总经过时间:1000ms

这对我们来说是一个非常重要的问题,我在网上还没有找到任何信息.

-更新-

我在stackoverflow上发现了另一个(未答复)线程: 使用呼叫者位置信息,log4net变得非常慢Windows 10 Fall Creators Update(1709)之后

我已经在两种环境下运行了磁盘基准测试,并且读写速率没有显着差异. 我已经测试了应用程序,完全禁用了log4net(log4net threshold ="OFF"),现在的计时非常相似,因此,就像@DalmTo注释一样,由于log4net,有很多可能性,我将尝试放一个问题,尽管已经有一个相关的Microsoft问题:解决方案

您可能会遇到此问题:

从2017年10月开始,升级到Windows 10版本1709后 或.NET Framework 4.7.1,您注意到 运行使用.NET Framework的.NET Framework应用程序时的性能 System.Diagnostics.StackFrame类.

当应用程序抛出.NET时,它们通常依赖于StackFrame 例外情况.如果发生率很高(每事件10次以上) 第二),应用程序可能会显着降低速度(十倍)并运行 明显比以前慢.

https://support.microsoft.com/zh-cn/help/4058258

包含以下修复程序: 大量使用System.Diagnostics.StackTrace或Exception.StackTrace的应用程序在.NET Framework 4.7.1上的运行速度可能会更慢.

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

解决方案

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/

这篇关于秋季创作者会更新性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆