- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
在负载很重的情况下,我们的应用程序使一个强大的服务器的 CPU 使用率达到 100%。阅读进程转储,查看线程,其中一些已超过 10 分钟。在使用 !CLRStack 时,它们都没有给我任何见解。
!runaway 给我:
0:030> !runaway
User Mode Time
Thread Time
53:2e804 0 days 0:10:04.703
30:31894 0 days 0:07:51.593
33:47100 0 days 0:07:24.890
42:11e54 0 days 0:06:45.875
35:35e18 0 days 0:06:07.578
41:54464 0 days 0:05:49.796
47:57700 0 days 0:05:45.000
44:3c2d4 0 days 0:05:44.265
32:3898c 0 days 0:05:43.593
50:54894 0 days 0:05:41.968
51:5bc58 0 days 0:05:40.921
43:14af4 0 days 0:05:40.734
48:35074 0 days 0:05:40.406
...
在其中一个线程上调用 !DumpStack,我得到:
0000001ab442f900 00007ff9ef4c1148 KERNELBASE!WaitForSingleObjectEx+0x94, calling ntdll!NtWaitForSingleObject
0000001ab442f980 00007ff9e920beb2 clr!SVR::gc_heap::compute_new_dynamic_data+0x17b, calling clr!SVR::gc_heap::desired_new_allocation
0000001ab442f9a0 00007ff9e90591eb clr!CLREventWaitHelper2+0x38, calling kernel32!WaitForSingleObjectEx
0000001ab442f9b0 00007ff9e90e0d2c clr!WriteBarrierManager::UpdateEphemeralBounds+0x1c, calling clr!WriteBarrierManager::NeedDifferentWriteBarrier
0000001ab442f9e0 00007ff9e9059197 clr!CLREventWaitHelper+0x1f, calling clr!CLREventWaitHelper2
0000001ab442fa40 00007ff9e9059120 clr!CLREventBase::WaitEx+0x70, calling clr!CLREventWaitHelper
0000001ab442fa70 00007ff9ef4c149c KERNELBASE!SetEvent+0xc, calling ntdll!NtSetEvent
0000001ab442faa0 00007ff9e90ef1e1 clr!SVR::gc_heap::set_gc_done+0x22, calling clr!CLREventBase::Set
0000001ab442fad0 00007ff9e90e9331 clr!SVR::gc_heap::gc_thread_function+0x8a, calling clr!CLREventBase::WaitEx
0000001ab442fb00 00007ff9e92048e7 clr!SVR::gc_heap::gc_thread_stub+0x7a, calling clr!SVR::gc_heap::gc_thread_function
0000001ab442fb60 00007ff9e91a0318 clr!Thread::CLRSetThreadStackGuarantee+0x48, calling kernel32!SetThreadStackGuaranteeStub
0000001ab442fb90 00007ff9e91a01ef clr!Thread::CommitThreadStack+0x10, calling clr!Thread::CLRSetThreadStackGuarantee
0000001ab442fbd0 00007ff9e910df0b clr!ClrFlsSetValue+0x57, calling kernel32!SetLastErrorStub
0000001ab442fc00 00007ff9e92048dc clr!SVR::gc_heap::gc_thread_stub+0x6f, calling clr!_chkstk
0000001ab442fc40 00007ff9f0d316ad kernel32!BaseThreadInitThunk+0xd
0000001ab442fc70 00007ff9f1e54409 ntdll!RtlUserThreadStart+0x1d
它在告诉我什么?我看到很多对 CLR 的调用,但我不明白问题出在哪里。在 .reload(由 Thomas 建议)之后,我现在可以看到 GC 调用。
更新 1
运行 xperf 后,每个 w3wp.exe 都消耗了大约 45% 的 CPU。按其中之一过滤并按功能分组,有一个功能标记为“?”占 13.62%,其他占 2.67% 以下。我如何设法知道这个“?”是什么?
更新 2
再次运行 xperf,函数 JIT_MonEnterWorker_InlineGetThread_GetThread_PatchLabel
占用了 12.31% 的 CPU 使用率。这 ”?”功能仍然存在。
按堆栈分组:
Line #, Stack, Count, Weight (in view), TimeStamp, % Weight
2, |- ?!?, 501191, 501222.365294, , 35.51
3, | |- clr.dll!JITutil_MonContention, 215749, 215752.552227, , 15.28
4, | |- clr.dll!JIT_MonEnterWorker_InlineGetThread_GetThread_PatchLabel, 170804, 170777.100191, , 12.10
如您所见,这两个占用了超过 27% 的 CPU 使用率(对于每个进程,因此很重要)。
更新 3
使用 wpr.exe 后(@magicandre1981 建议):
wpr.exe -start cpu and wpr -stop result.etl
我发现 FormsAuthentication 和在关键路径上对 Ninject 的一些不必要的调用导致了大约 16% 的 CPU 使用率。我仍然不明白运行 gor 10 分钟或更长时间的线程。
更新 4
尝试了 DebugDiag(@leppie 的建议),它只是确认挂起的线程都类似于:
Thread ID: 53 Total CPU Time: 00:09:11.406 Entry Point for Thread: clr!Thread::intermediateThreadProc
Thread ID: 35 Total CPU Time: 00:07:26.046 Entry Point for Thread: clr!SVR::gc_heap::gc_thread_stub
Thread ID: 50 Total CPU Time: 00:07:01.515 Entry Point for Thread: clr!SVR::gc_heap::gc_thread_stub
Thread ID: 29 Total CPU Time: 00:06:02.264 Entry Point for Thread: clr!SVR::gc_heap::gc_thread_stub
Thread ID: 31 Total CPU Time: 00:06:41.281 Entry Point for Thread: clr!SVR::gc_heap::gc_thread_stub
或由于 StackExchange.Redis:
DomainBoundILStubClass.IL_STUB_PInvoke(Int32, IntPtr[], IntPtr[], IntPtr[], TimeValue ByRef)+e1
[[InlinedCallFrame] (StackExchange.Redis.SocketManager.select)] StackExchange.Redis.SocketManager.select(Int32, IntPtr[], IntPtr[], IntPtr[], TimeValueByRef)
StackExchange.Redis.SocketManager.ReadImpl()+889
StackExchange.Redis.SocketManager.Read()+66
或
[[GCFrame]]
[[HelperMethodFrame_1OBJ] (System.Threading.Monitor.ObjWait)] System.Threading.Monitor.ObjWait(Boolean, Int32, System.Object)
mscorlib_ni!System.Threading.Monitor.Wait(System.Object, Int32)+19
StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[[System.__Canon, mscorlib]](StackExchange.Redis.Message, StackExchange.Redis.ResultProcessor`1, StackExchange.Redis.ServerEndPoint)+24f
StackExchange.Redis.RedisBase.ExecuteSync[[System.__Canon, mscorlib]](StackExchange.Redis.Message, StackExchange.Redis.ResultProcessor`1, StackExchange.Redis.ServerEndPoint)+77
[[StubHelperFrame]]
StackExchange.Redis.RedisDatabase.SetMembers(StackExchange.Redis.RedisKey, StackExchange.Redis.CommandFlags)+ee
最佳答案
手动执行此操作需要勇气 ;) 请检查此官方 MS DebugDiag 2.2:https://www.microsoft.com/en-us/download/details.aspx?id=49924它配备了分析仪,因此您不必用手操作。使用 DebugDiag,我认为您会更快地找到问题...
关于c# - xperf WinDBG C# .NET 4.5.2 应用程序 - 了解进程转储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32824995/
我有两个问题: 我发现一篇博客文章说在使用 xperf 时应该设置 DisablePagingExecutive: http://blogs.msdn.com/b/pigscanfly/archive
我正在尝试使用 XPerf 分析系统。并看到当 HardFaults 中有事件时会出现性能问题! 但是我无法弄清楚并在谷歌中找到 xperf 显示的这些硬故障是什么。它们有什么关系?它们说明了什么?对
我正在试验使用 XPerf 来检测应用程序以进行性能分析。我的目标是记录我的 C# 应用程序中的启动/停止事件,并分析这些事件之间的某些内核指标。 我正在我的应用程序中创建一个 TraceListen
我写了一个小的 tcp-client/server-thing 来测试 xperf-networkttrace 功能。但看起来我确实在 xperf 上做错了什么。当我使用 Xperf 内核组 NETW
我通读了文档并使用了概述的命令,但是出于某种原因,我似乎没有得到任何符号,只有摘要表函数列中的一系列“未知数”,除了应用程序的最顶层集合我正在尝试调试....我将环境变量设置为 Microsoft 服
抱歉这个愚蠢的问题。我是 Xperf 新手。 我在 64 位 Windows 8.1 上,我的应用程序也是 x64。我想使用 Xperf 在应用程序中捕获调用堆栈和我定义的事件。 我在我的应用程序中注
使用 xperf,我可以生成跟踪并获得所有文件的“平面”列表,如下所示: xperf -on FileIO+FILE_IO+FILE_IO_INIT+FILENAME -stackwalk FileR
是否可以显示包含函数的计时,即一个函数及其所有子函数在 windows 性能分析器和/或 xperf 中运行的总时间。我想知道独立于来电者的时间。 我知道我可以从堆栈列中获取依赖于调用者的包含时间,以
我正在尝试使用 xperf 分析 ASP.NET 应用程序(本地运行)中的 CPU 时间。 到目前为止,我遵循了标准程序: 以管理员身份运行 cmd xperf -on 基础 在网络应用中执行一些操作
我在使用 xperf 跟踪获取完整调用堆栈时遇到了一些问题。这是在 Win7 64 位电脑上。在更高层次上,我有一个加载多个 dll 的 exe,它们也完成了大部分工作。所有 pdb 文件都在一个目录
我正在尝试使用 xperf 来分析我的 DLL,但它拒绝使用我的 DLL 的 PDB 文件。使用 -symbols 在 .etl 上运行 xperf,我得到: DBGHELP: mydll- priv
我已经从 Windows SDK 安装了 Xperf 性能分析器,并使用以下命令捕获了文档中描述的跟踪: xperf -on SysProf -stackwalk profile 仍然,堆栈跟踪不包含
我运行 xperf 是为了在运行程序时获取程序的跟踪信息。程序读取一个文件。它是一个用 F# 编写的 .NET 程序,文件在这里读取: System.IO.File.ReadAllLines("MyR
我无法弄清楚要提供给 XPerf.exe 的命令行开关和参数的正确组合,以使其加载 WPF ETW 提供程序(Microsoft-Windows-WPF?a42c77db-874f-422e-9b44
我最近开始熟悉 perfmon 和 xperf。 Perfmon 使用性能计数器,而 xperf 使用 ETW(Windows 事件跟踪)。 Perfmon 具有提供数据的对象,而 xperf 使用“
在负载很重的情况下,我们的应用程序使一个强大的服务器的 CPU 使用率达到 100%。阅读进程转储,查看线程,其中一些已超过 10 分钟。在使用 !CLRStack 时,它们都没有给我任何见解。 !r
感谢 JMH,我正在为我的 JAVA 应用程序添加微基准测试。 我在 Windows 10 上运行基准测试: stack 分析器运行良好: java -jar target/benchmarks.ja
我是一名优秀的程序员,十分优秀!