繁体   English   中英

VSPerf和Azure云服务

[英]VSPerf and Azure Cloud Services

当我将云服务部署到Windows Azure时,会导致许多VSPerf.exe实例启动 - 从1到5。

在它们之间它们消耗所有CPU,并且没有任何进程自行终止。

如果我远程连接到实例并手动终止进程,则会在下一个请求时重新启动。 如果在请求期间终止进程,则请求成功,页面显示并按预期运行。

唯一的区别是之前的部署是我已经升级到.NET 4.5,因此将云服务升级到服务器2012。

可能是什么导致了这个?

更新

对于每次失败的启动,都会记录2个事件:

  • VsPerf Tool Error: Error starting data collection with a dedicated process D:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Team Tools\\Performance Tools\\VSPerf.

  • .NET Runtime version 4.0.30319.18010 - Loading profiler failed during CoCreateInstance. Profiler CLSID: '{44a86cad-f7ee-429c-83eb-f3cde3b87b70}'. HRESULT: 0x80040111. Process ID (decimal): 1444. Message ID: [0x2504].

更新2

创建新实例或重新映像计算机后,VSPerf问题不会发生(至少那是一个修复程序(一个烦人且耗时的修复程序))。

检查Visual Studio中的Azure发布设置,我敢打赌您已在“高级”选项卡上启用了性能分析。

VS发布设置

同样的问题,VSPerf.exe的2个进程在第二个角色实例上烧掉100%的CPU。 IIS在该实例上变得无响应。 我们在4个月前遇到了完全相同的问题,当我们在MSFT支持中调试此问题时启用了性能分析时,“某种程度上”消失了(MSFT中有人知道这个问题)。 但是没有能够重现这个问题(我们只有屏幕截图)它被删除了。

自从我再次看到它,5分钟后,由于Azure SDK 2.0可以轻松获取诊断日志(与SDK 1.8中的配置仪式不同),这对于下一个有意义的人来说是有用的

核心错误是Application VsPerf Tool Error: Error starting data collection with a dedicated process D:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Team Tools\\Performance Tools\\VSPerf. 下面有详细的日志(4个条目)。 有趣的是,我有两个VSPerf.exe进程占用100%的CPU,还有2个日志条目....

{555908d1-a6d7-4695-8e1e-26931d2012f4}  Service Control Manager 7011    System  A timeout (30000 milliseconds) was reached while waiting for a transaction response from the iphlpsvc service.  <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='Service Control Manager' Guid='{555908d1-a6d7-4695-8e1e-26931d2012f4}' EventSourceName='Service Control Manager'/><EventID Qualifiers='49152'>7011</EventID><Version>0</Version><Level>2</Level><Task>0</Task><Opcode>0</Opcode><Keywords>0x8080000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:37:25.557218700Z'/><EventRecordID>1269</EventRecordID><Correlation/><Execution ProcessID='520' ThreadID='1104'/><Channel>System</Channel><Computer>RD00155DA909B8</Computer><Security/></System><EventData><Data Name='param1'>30000</Data><Data Name='param2'>iphlpsvc</Data></EventData></Event>   WebApp_IN_1 6/23/2013 5:37 PM   2   520 1104
{555908d1-a6d7-4695-8e1e-26931d2012f4}  Service Control Manager 7011    System  A timeout (30000 milliseconds) was reached while waiting for a transaction response from the Schedule service.  <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='Service Control Manager' Guid='{555908d1-a6d7-4695-8e1e-26931d2012f4}' EventSourceName='Service Control Manager'/><EventID Qualifiers='49152'>7011</EventID><Version>0</Version><Level>2</Level><Task>0</Task><Opcode>0</Opcode><Keywords>0x8080000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:37:56.259560100Z'/><EventRecordID>1270</EventRecordID><Correlation/><Execution ProcessID='520' ThreadID='1104'/><Channel>System</Channel><Computer>RD00155DA909B8</Computer><Security/></System><EventData><Data Name='param1'>30000</Data><Data Name='param2'>Schedule</Data></EventData></Event>   WebApp_IN_1 6/23/2013 5:37 PM   2   520 1104
00000000-0000-0000-0000-000000000000    VSPERF  4100    Application VsPerf Tool Error: Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf. <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='VSPERF'/><EventID Qualifiers='57635'>4100</EventID><Level>2</Level><Task>0</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:40:37.000000000Z'/><EventRecordID>266</EventRecordID><Channel>Application</Channel><Computer>RD00xxxxxxxxx</Computer><Security/></System><EventData><Data>Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf.</Data></EventData></Event> WebApp_IN_1 6/23/2013 5:40 PM   2   0   0
00000000-0000-0000-0000-000000000000    VSPERF  4100    Application VsPerf Tool Error: Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf. <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='VSPERF'/><EventID Qualifiers='57635'>4100</EventID><Level>2</Level><Task>0</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:40:41.000000000Z'/><EventRecordID>267</EventRecordID><Channel>Application</Channel><Computer>RD00xxxxxxxxx</Computer><Security/></System><EventData><Data>Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf.</Data></EventData></Event> WebApp_IN_1 6/23/2013 5:40 PM   2   0   0

我找到的最接近的解决方法是创建一个启动任务

<Task commandLine="VSPerf.cmd" executionContext="elevated" taskType="background" />

其中VSPerf.cmd是一个简单的启动器

PowerShell -ExecutionPolicy Unrestricted .\VSPerf.ps1
exit /B 0

对于试图杀死过度活动的VSPerf实例的PowerShell脚本:

function Restart-VSPerf {
    $procs = (
        gwmi -Query "SELECT IDProcess,PercentProcessorTime FROM Win32_PerfFormattedData_PerfProc_Process WHERE Name='vsperf' AND PercentProcessorTime > 25" |
        Foreach-Object { $_pid = $_.IDProcess ; gwmi -Query "SELECT Handle,CommandLine FROM win32_process WHERE Name='vsperf.exe' AND Handle=$_pid" | Select-Object Handle, CommandLine }
    )
    if ($procs) {
        # Get VSPerf path.
        # NB The regex uses conditional matching with an expression, as described in https://msdn.microsoft.com/en-us/library/36xybswe.aspx
        # to ensure that a single capturing group gets the contents of quoted arguments and unquoted arguments.
        $regex = [regex] '^(("?)((?(?<=")[^"]*|[^"\s]*))\2(\s+|$))+$'
        $vsperf = $regex.Match($procs[0].CommandLine).Groups[3].Captures[0].Value

        & $vsperf /detach

        # Kill
        $procs | Foreach-Object { Stop-Process -Force -Id $_.Handle }

        # Restart
        Start-Sleep -s 1
        $procs | Foreach-Object {
            $_args = ($regex.Match($_.CommandLine).Groups[3].Captures[1..99] |  Select-Object -ExpandProperty Value)
            Start-Process $vsperf -ArgumentList "$_args"
        }
    }
}

while (1) {
    Start-Sleep -s 180
    Restart-VSPerf
}

它有时有效,但并非总是如此。 欢迎提出可靠性改进的建议。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM