在自托管Web应用程序中使用性能计数器

时间:2014-05-01 22:44:09

标签: asp.net azure owin self-hosting

我想强调测试我的Web Api自托管应用程序。此应用程序托管在Azure辅助角色上。

我知道如何从我的工作者角色到我的存储(用于分析)获得性能计数器,但因为我的web api是使用Microsoft.Owin.Host.HttpListener自托管的,所以我不知道是否有一些我可以插入的现有性能计数器。

我已经尝试了几个计数器perfmon:

  • AspNet Application
  • Web服务(这只允许我选择在IIS中定义的Web应用程序)

当我选择流程时,我没有像req / sec等那样有趣的计数器...

有没有办法为Self Hosted Owin应用程序激活一些计数器?

仅使用我尚未制作的配置? 使用其他自我主持人? 使用其他组件并修改我的代码? (添加属性......,我已经看到类似https://github.com/aliostad/PerfIt的内容)

非常感谢。

1 个答案:

答案 0 :(得分:1)

我看到你提到了诊断,这些是我在诊断中使用的:

<PerformanceCounterConfiguration counterSpecifier="\Asp.net\Request Execution Time" sampleRate="PT1M" />
                <PerformanceCounterConfiguration counterSpecifier="\ASP.net\Requests Rejected" sampleRate="PT1M" />
                <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Current Connections" sampleRate="PT1M" />
                <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Connection Attempts/sec" sampleRate="PT1M" />

我做了什么,进入perfmon并在我的开发机器上右键单击“添加计数器”,然后在cmd提示符下键入与我相似的名称,如下所示:

typeperf "\Web Service(_Total)\Connection Attempts/sec"

我能够测试很多,看看哪些是有用的。

希望它有所帮助,

=德文