【问题标题】:Why callback from wcf service is so slow (especially the first time)为什么 wcf 服务的回调这么慢(尤其是第一次)
【发布时间】:2012-11-10 04:11:30
【问题描述】:

我有一个每秒向连接的客户端发送多个回调的服务。为什么当服务发送消息时,客户端会在几秒或更长时间后收到消息?

以下是配置详情:

        <bindings>
                  <wsDualHttpBinding>
                    <binding name="WSDualHttpBinding_IMyService" receiveTimeout="00:30:00" 
    sendTimeout="00:30:00" useDefaultWebProxy="false" maxBufferPoolSize="2147483647" 
maxReceivedMessageSize="2147483647">

                      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                      <security mode="None"/>
                    </binding>
                  </wsDualHttpBinding>
                </bindings>
                <behaviors>
                  <serviceBehaviors>
                    <behavior name="Service1Behavior">
                      <serviceMetadata httpGetEnabled="True"/>
                      <serviceDebug includeExceptionDetailInFaults="True"/>
                      <serviceThrottling maxConcurrentCalls="10"
                                maxConcurrentInstances="10"
                                maxConcurrentSessions="5" />
                    </behavior>
                  </serviceBehaviors>
                </behaviors>

【问题讨论】:

  • 原因有很多。您可能想提供更多详细信息。可能是内存压力(我已经看到有很多客户端和大消息)、CPU 压力等。有多少客户端?您的服务器上有多少个内核?您可以尝试调整您的限制设置。

标签: c# wcf .net-4.0 callback app-config


【解决方案1】:

您所描述的可能与线程创建时间有关。
见这里:WCF service may scale up slowly under load

“根据执行时间和收到的请求数量,您可能会注意到 WCF 执行时间对于每个收到的请求线性增加大约 500 毫秒,直到进程创建了足够的 IOCP 线程来服务请求或维持传入负载。”

文章中提供了解决方法。

【讨论】:

    【解决方案2】:

    我正在处理同样的问题,查看这些链接以解决问题。

    概述似乎是开箱即用的 WCF 被“锁定”以防止 DoS 漏洞。本质上,您需要按照以下链接中的说明取消对服务的限制。

    http://theburningmonk.com/2010/05/wcf-improve-performance-with-greater-concurrency/

    http://blogs.msdn.com/b/wenlong/archive/2010/02/11/why-are-wcf-responses-slow-and-setminthreads-does-not-work.aspx

    http://weblogs.asp.net/sweinstein/archive/2009/01/03/creating-high-performance-wcf-services.aspx

    【讨论】:

      猜你喜欢
      • 2016-05-12
      • 1970-01-01
      • 2018-06-02
      • 2020-11-11
      • 2012-06-07
      • 1970-01-01
      • 1970-01-01
      • 2019-03-01
      相关资源
      最近更新 更多