2

これはどのように可能ですか?片道の電話は火事だと思って忘れました。メソッドは一方向としてマークされています。コールバック同時実行モードはMultipleに設定され、コールバッククラスのUseSychronizationContextはfalseに設定されます。送信されるデータは1KB以下ですが、約30〜40個の小さなメッセージを同時に送信するたびに、呼び出しがブロックされ始め、最終的には一部のメッセージがタイムアウトします。クライアント->サーバー呼び出しを約16000/秒でベンチマークしました。クライアントにコールバックしようとすると、1秒あたり約2つしか集めることができません。これは、OneWayコールです。

サーバーのバインディング構成は次のようになります。

<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.
}
}
4

1 に答える 1

2

私はそれを考え出した。プロセスでスレッドプールをブロックして不足させていたサービスへの呼び出しがありました。また、wcfサービス内からスレッドプールで呼び出しを呼び出していました。これらのメソッドはスレッドプール自体で呼び出されるため、これは悪い習慣です。一方向の呼び出しを行い、スレッドプールが不足している場合、実行するスレッドがないため、一方向の呼び出しはタイムアウトになります。ありがとう

于 2011-04-14T19:07:47.960 に答える