WCF单向回调超时?

WCF单向回调超时?,wcf,wcf-callbacks,Wcf,Wcf Callbacks,这怎么可能?我还以为单向通话是失火和遗忘。该方法被标记为单向。回调并发模式设置为Multiple,回调类的UseSynchronizationContext设置为false。正在发送的数据不超过1KB,但每次我同时发送大约30-40条小消息时,调用开始阻塞,最终其中一些超时。我已经将我的客户机->服务器调用的基准测试为大约16000/秒。当我试着回电话给客户时,我每秒只能召集2个,这是一个单向呼叫 我的服务器绑定配置如下所示: <system.serviceModel> <bi

这怎么可能?我还以为单向通话是失火和遗忘。该方法被标记为单向。回调并发模式设置为Multiple,回调类的UseSynchronizationContext设置为false。正在发送的数据不超过1KB,但每次我同时发送大约30-40条小消息时,调用开始阻塞,最终其中一些超时。我已经将我的客户机->服务器调用的基准测试为大约16000/秒。当我试着回电话给客户时,我每秒只能召集2个,这是一个单向呼叫

我的服务器绑定配置如下所示:

<system.serviceModel>
<bindings>
  <netNamedPipeBinding>
    <binding name="netNamedPipeBinding1" receiveTimeout="23:00:00" maxReceivedMessageSize="1048576" maxBufferPoolSize="1048576" maxConnections="500">
      <readerQuotas maxStringContentLength="99999999" maxArrayLength="9999999" maxBytesPerRead="999999"/>
      <security mode="None"/>
    </binding>
  </netNamedPipeBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="highThroughPut">
      <serviceThrottling maxConcurrentCalls="3000" maxConcurrentInstances="3000" maxConcurrentSessions="3000"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="OLII.Apps.Services.Data.DataServices.DataService" behaviorConfiguration="highThroughPut">
    <endpoint bindingConfiguration="netNamedPipeBinding1" address="net.pipe://localhost/DataListener" binding="netNamedPipeBinding" contract="OLLI.Apps.Services.ProxyClients.DataServerProxyClient.IDataListenerService"/>
   </service>
</services>
</system.serviceModel>
   public interface IDataCallbackClient
    {
        [OperationContract(IsOneWay = true)]
        void GetData(string file, int id);
    }
   [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
    public class DataCallback : IDataCallbackClient
    {
public void GetData(string file, int id)
{
//If I put Thread.Sleep(5000);  When the server calls this method, the first few go through, and subsequent calls block.  If I do a return statement here, all the calls go through really fast on the server side.
//Does some processing with file and id.  It then goes back to server with data.
}
}
我的客户端回调类如下所示:

<system.serviceModel>
<bindings>
  <netNamedPipeBinding>
    <binding name="netNamedPipeBinding1" receiveTimeout="23:00:00" maxReceivedMessageSize="1048576" maxBufferPoolSize="1048576" maxConnections="500">
      <readerQuotas maxStringContentLength="99999999" maxArrayLength="9999999" maxBytesPerRead="999999"/>
      <security mode="None"/>
    </binding>
  </netNamedPipeBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="highThroughPut">
      <serviceThrottling maxConcurrentCalls="3000" maxConcurrentInstances="3000" maxConcurrentSessions="3000"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="OLII.Apps.Services.Data.DataServices.DataService" behaviorConfiguration="highThroughPut">
    <endpoint bindingConfiguration="netNamedPipeBinding1" address="net.pipe://localhost/DataListener" binding="netNamedPipeBinding" contract="OLLI.Apps.Services.ProxyClients.DataServerProxyClient.IDataListenerService"/>
   </service>
</services>
</system.serviceModel>
   public interface IDataCallbackClient
    {
        [OperationContract(IsOneWay = true)]
        void GetData(string file, int id);
    }
   [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
    public class DataCallback : IDataCallbackClient
    {
public void GetData(string file, int id)
{
//If I put Thread.Sleep(5000);  When the server calls this method, the first few go through, and subsequent calls block.  If I do a return statement here, all the calls go through really fast on the server side.
//Does some processing with file and id.  It then goes back to server with data.
}
}

我想出来了。我有对我的服务的调用,在这个过程中阻塞并耗尽了线程池。我还从我的wcf服务内部调用线程池上的调用,这是一种糟糕的做法,因为这些方法是在线程池上调用的。看起来,当您进行单向调用时,线程池不足,单向调用将超时,因为它没有可执行的线程。
谢谢

可能回调也使用了节流功能?你使用的是什么版本的.NET framework?我使用的是.NET 4.0。我注意到第一批并发调用需要很长时间,有时连接甚至会丢失。下一批并发调用,速度很快。这里是否存在JIT编译问题?我该如何编写代码呢?我将限制设置得非常高:更奇怪的是,如果我的回调方法只是返回回调,那么回调速度很快。但是,如果我在回调方法中设置了睡眠,那么服务器上的回调调用将挂起,就好像它在等待客户端一样。然而,这些都是单向调用,那么为什么服务器要等待客户端回调返回呢?这听起来真的很奇怪。您是否可以发布更多有关服务和回调合同以及绑定的信息?您是否能够测量在其他呼叫被阻止和等待之前,客户端可以处理多少个呼叫?这总是同一个号码吗?