收集 .NET Apps/Avg. Request Time (毫秒)

Microsoft.SystemCenter.Apm.ApplicationInstance.AvgRequestTimeMonitor (UnitMonitor)

收集 .NET Apps/Avg. Request Time 性能计数器(毫秒)

Knowledge Base article:

摘要

如果每个指定时段内的平均请求时间超过监视器阈值,则实例状态将变为不正常。

原因

在性能事件数超过所配置的监视器阈值时,将生成应用程序性能警报。

服务器问题或查询结构和复杂性的问题可能会导致数据库调用时间过长。 文件服务器问题可能会导致文件 I/O 时间很长。 Web 服务或它驻留的服务器关闭,或者 Web 服务代码中出现问题,都可能会导致 Web 服务的性能问题。 复杂或低效的代码可能会导致应用程序的内部执行时间很长。

解决方法

应用程序性能下降的原因通常包括,数据库调用时间长、Web 服务调用时间长、.NET 远程调用速度慢、COM+ 调用速度慢或者应用程序代码效率低。

Element properties:

TargetMicrosoft.SystemCenter.Apm.ApplicationInstance
Parent MonitorSystem.Health.PerformanceState
CategoryCustom
EnabledFalse
Instance Name.NET Apps
Counter NameAvg. Request Time
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeSystem.Performance.ConsecutiveSamplesThreshold
RemotableFalse
AccessibilityPublic
Alert Message
.NET Apps/Avg. Request Time 超过了阈值
.NET Apps/Avg. Request Time 性能计数器超过了所配置的阈值 {0} 毫秒。性能计数器的值为 {1} 毫秒。
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.Apm.ApplicationInstance.AvgRequestTimeMonitor" Accessibility="Public" Enabled="false" Target="Microsoft.SystemCenter.Apm.ApplicationInstance" ParentMonitorID="Health!System.Health.PerformanceState" Remotable="false" Priority="Normal" TypeID="Performance!System.Performance.ConsecutiveSamplesThreshold" ConfirmDelivery="false">
<Category>Custom</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.Apm.ApplicationInstance.AvgRequestTimeMonitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="Microsoft.SystemCenter.Apm.ApplicationInstanceBase"]/AvgRequestTimeMonitorThreshold$</AlertParameter1>
<AlertParameter2>$Data/Context/SampleValue$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="ConditionFalse" HealthState="Success"/>
<OperationalState ID="Warning" MonitorTypeStateID="ConditionTrue" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<ComputerName>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<CounterName>Avg. Request Time</CounterName>
<ObjectName>.NET Apps</ObjectName>
<InstanceName>$Target/Property[Type="Microsoft.SystemCenter.Apm.ApplicationInstance"]/CounterInstance$</InstanceName>
<AllInstances>false</AllInstances>
<Frequency>$Target/Property[Type="Microsoft.SystemCenter.Apm.ApplicationInstanceBase"]/AvgRequestTimeMonitorInterval$</Frequency>
<Threshold>$Target/Property[Type="Microsoft.SystemCenter.Apm.ApplicationInstanceBase"]/AvgRequestTimeMonitorThreshold$</Threshold>
<Direction>greater</Direction>
<NumSamples>3</NumSamples>
</Configuration>
</UnitMonitor>