【问题标题】:wcf app slowing down, corrected by recycling IIS app pool, what can i monitor to see what is going wrongwcf 应用程序变慢,通过回收 IIS 应用程序池进行纠正,我可以监控什么以查看问题所在
【发布时间】:2021-11-26 21:16:27
【问题描述】:

WCF 应用程序内置于 .net 4.5 中,在 windows server 2012 R2 数据中心上运行。 IIS 8. 客户端是一次点击 WPF 应用程序。

该应用程序已运行多年,但已开始越来越陷入困境,需要应用程序池回收以每天纠正一两次。我找不到任何迹象表明究竟出了什么问题。 RAM 达到 75% 的峰值,大部分保持在 50% 左右,cpu 运行在 10% 到 20% 之间。当我回收池时,那里并没有真正改变。

我的主要线索是应用程序使用 TCP,当我将本地调试会话切换到 HTTP 时,它再次快速运行,在 TCP 模式下运行速度很慢。我知道 HTTP 是在 TCP 之上分层的,所以我想知道它是否与握手或其他有关。

TCP 绑定如下所示

   <binding name="TCPSecured" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>

HTTP

<binding name="HTTPBindingConfig" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
  <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Windows" />
  </security>
  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>

使用资源监视器查看 TCP 连接,我看到几十个具有高延迟的,超过 200 个。不知道这意味着什么,或者它是否是新的。

使用性能监视器,我尝试跟踪来自 ASP.Net 应用程序、TYCPv4 和 TCP v6 以及其他几十个应用程序的许多选择,它们都显示低到没有活动。

我对这些东西不知所措,希望人们能提供任何见解。

【问题讨论】:

  • 如果应用在使用http时可以快速运行,为什么不使用http模式呢?

标签: .net wcf iis-8


【解决方案1】:

问题是由于 TCP 端口处于打开状态。一旦我能够监控它,这让我能够找到问题所在。最终使用了 powershell 命令。

检查一个端口

$established = Get-NetTCPConnection -LocalPort 890 -State Established
$count = $established.Length
echo "OK - $count established connections on port 890 Business"

查看所有这些。

$netstat = netstat -aon | Select-String -pattern "TCP "
$processList = Get-Process
foreach ($result in $netstat) {
   $splitArray = $result -split " "
   $procID = $splitArray[$splitArray.length – 1]
   $processName = $processList | Where-Object {$_.id -eq $procID} |    select processname
   $splitArray[$splitArray.length – 1] = $procID + " " +      $processName.processname
   $splitArray -join " "
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-20
    • 1970-01-01
    • 1970-01-01
    • 2012-04-16
    • 2011-08-22
    • 2018-07-07
    相关资源
    最近更新 更多