因此,我面临这样一种情况:部署在Azure云上的项目在大多数情况下CPU使用率高达100%,但在重新启动应用程序后,CPU使用率在几个小时内达到10-15%。我确实尝试过使用Kudu profiler,但它没有帮助,大多数情况下,它显示当总CPU使用率为100%时,某些方法使用40%的CPU,但当CPU使用率较低时,CPU使用率为2-3%。奇怪的是,我注意到一些API控制器方法,如果它们没有得到正确的请求主体抛出CGI/502错误,即使它应该是抛出空引用异常因为方法得到了错误的主体,更有趣的是-返回CGI异常大约需要2分钟,而不是像我在本地计算机上的web服务上通常需要2秒。我从S1转到了S2计划,同样的东西,尽管运行速度更快,但azure的洞察力显示相同的90-10%的CPU使用率。
发布于 2019-06-25 13:35:25
首先,我建议你写一个代码来获得你的服务器的崩溃转储,你可以参考这个link进行设置。
下面的内容会帮助你用powershell编写它。
$dumpFolder = "C:\crash-dumps"
if (!(Test-Path $dumpFolder)) {
mkdir $dumpFolder | Out-Null
}
$dumpKey = "HKLM:SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps"
if (!(Test-Path $dumpKey)) {
New-Item -Path $dumpKey | Out-Null
}
$dumpKey = "HKLM:SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe"
New-Item -Path $dumpKey -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpFolder -Value $dumpFolder -PropertyType String -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpCount -Value 3 -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpType -Value 2 -PropertyType DWORD -Force | Out-Null
$dumpKey = "HKLM:SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\w3wp.exe"
New-Item -Path $dumpKey -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpFolder -Value $dumpFolder -PropertyType String -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpCount -Value 3 -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpType -Value 2 -PropertyType DWORD -Force | Out-Null基于崩溃转储,我们可以很容易地理解是哪个部分导致了问题。
对于类似的问题,您可以跟踪此request。还要尝试将您的应用程序降级到V2.0.0,看看它是否仍然会导致CPU峰值。如果是,那么我们需要查看评论中提到的代码。
https://stackoverflow.com/questions/56670052
复制相似问题