ASP网不使用所有可用的内核-Foreach
我们的ASP Net软件具有此特定条件,其中Parallel.Foreach
被应用。它运行良好,但最近我们注意到,它不再使用所有可用的核心用于应用并行性的特定重型操作。
这是我们使用的代码:
Parallel.ForEach(var1, new ParallelOptions
{ MaxDegreeOfParallelism = Environment.ProcessorCount - 1 }, var2 => ...
在运行这些特定的重型操作时,我们过去在任务管理器上看到的是32x内核服务器的高使用(例如90%)。但是现在它仅使用一个核心(仅约5%)保持自己。过去需要20-40分钟的时间需要5-6个小时!
在我们的计算机上(与Visual Studio本地运行)时,我们确实看到所有核心都按预期工作(使用率为80-90%)。
详细信息:服务器具有2X CPU,X64,Windows Server 2012 Bare Metal(无VM)。没有硬件问题。软件以ASP NET 4.6.2运行。 MaxDegreeofParallelism < / code>正确返回32。IIS管理器 /高级设置:CPU限制= 900。最大的工作过程似乎没有区别。数据库似乎并不是问题所在,因为所有数据以前都存储在内存中(列表变量在代码上)。
由于该代码过去在同一家服务器上正常工作,并且目前在我们的本地主机上工作正常,因此我们怀疑服务器端发生了什么变化。
我们怀疑Microsoft更新可能是引起此问题的更新,尽管到目前为止我们还没有发现任何东西。这些是我们怀疑的最新2022个更新:
- .NET Framework 3.5,4.6.2,
2022-05的安全性和质量汇总 Windows Server 2012的4.7、4.7.1、4.7.2、4.8 X64(KB5013871)。安装日期:25/05/2022 09:43
2022-04 .NET Framework 3.5,4.5.2, Windows Server 2012(kb5012330)的4.6、4.6.1、4.6.2、4.7、4.7、4.7.1、4.7.2、4.8。安装日期:20/04/2022 15:53
2022-02 .NET Framework 3.5,4.5.2, Windows Server 2012(KB5010582)的4.6、4.6.1、4.6.2、4.7、4.7、4.7.1、4.7.2、4.8。安装日期:11/02/2022 20:27
2022-01 .NET Framework 3.5,4.5.2, Windows Server 2012(KB5009720)的4.6、4.6.1、4.6.2、4.7、4.7、4.7.1、4.7.2、4.8。安装日期:12/01/2022 21:48
有人对此问题有所了解吗?关于如何解决此问题的任何想法?
Our ASP NET software has this specific condition where Parallel.ForEach
is applied. It was working fine, but we recently noticed that it stopped using all available cores for these specific heavy operations where parallelism is applied.
This is the code we use:
Parallel.ForEach(var1, new ParallelOptions
{ MaxDegreeOfParallelism = Environment.ProcessorCount - 1 }, var2 => ...
What we used to see at Task Manager was a high usage (like 90%) of our 32x cores server while running these specific heavy operations. But now it keeps itself using only one core (~5% only). What used to take 20-40 min now is taking 5-6 hours!
While on our computer (running locally with Visual Studio) we do see that all cores are working as expected (~80-90% usage).
Details: Server has 2x CPUs, x64, Windows Server 2012 bare metal (no VM). There are no hardware problems. Software runs at ASP NET 4.6.2. MaxDegreeOfParallelism
correctly returns 32. IIS Manager / Advanced Settings: CPU limit = 900. Maximum Worker Process seems to have no difference. Database doesn't seem to be the problem because all data are previously stored at memory (lists variables at the code).
As the code used to work fine at this same server, and currently works fine on our localhost, we suspect that something changed at the server side.
We suspect that a Microsoft update may be the one causing this, although we didn't found anything so far. These are the latest 2022 updates that we suspect:
2022-05 Security and Quality Rollup for .NET Framework 3.5, 4.6.2,
4.7, 4.7.1, 4.7.2, 4.8 for Windows Server 2012 for x64 (KB5013871). Installation date: 25/05/2022 09:432022-04 Security and Quality Rollup for .NET Framework 3.5, 4.5.2,
4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows Server 2012 for x64 (KB5012330). Installation date: 20/04/2022 15:532022-02 Security and Quality Rollup for .NET Framework 3.5, 4.5.2,
4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows Server 2012 for x64 (KB5010582). Installation date: 11/02/2022 20:272022-01 Security and Quality Rollup for .NET Framework 3.5, 4.5.2,
4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows Server 2012 for x64 (KB5009720). Installation date: 12/01/2022 21:48
Does anyone know something about this issue? Any ideas on how to troubleshoot this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试在服务器上运行此实验,作为独立的控制台应用程序:
预期的行为是查看CPU最大化(100%),并且报告的并发达到该值32。
You could try running this experiment on your server, as a standalone Console application:
The expected behavior is to see the CPU maxing out (100%), and the reported concurrency reaching the value 32.