title: C# TThreadPoolAsyncServer implementation for Apache Thrift is very very slow
body: <p>In below C# code snippet, you can see how I build a multi-threaded thrift server by using TThreadPoolAsyncServer implementation which is provided by the nuget package (namely C# .NET Core bindings for the Apache Thrift RPC system with version 0.14.1) that is available at: <a href="https://www.nuget.org/packages/ApacheThrift" rel="nofollow noreferrer">https://www.nuget.org/packages/ApacheThrift</a></p>
  <p>I have also implemented a gRPC version of this server implementation and in comparison to gRPC, TThreadPoolAsyncServer's performance is very very low (i.e. slow). I mean my thrift server that is using TThreadPoolAsyncServer can process only a few requests per minute while its gRPC counterpart can process thousands requests. My question is that &quot;Can this be caused by anything I do incorrectly in below code snippet?&quot; Do you think I am particularly missing/overlooking st here, which may cause a serious performance drawback? Many thanks in advance.</p>
  <pre><code>var serverHandler = new ThriftGatewayServerImpl(xyzInvokerService);
  
  var processor = new ThriftAPIGatewayService.AsyncProcessor(serverHandler);
  
  var protocolFactory = new TBinaryProtocol.Factory();
  var thriftConfiguration = new TConfiguration();                
  var serverTransport = new TServerSocketTransport(serverPort, thriftConfiguration);
  var transportFactory = new TBufferedTransport.Factory();
  var threadConfiguration = new TThreadPoolAsyncServer.Configuration();
  var loggerFactory = new SerilogLoggerFactory(Log.Logger);
  
  var server = new TThreadPoolAsyncServer(
       processorFactory: new TSingletonProcessorFactory(processor),
       serverTransport: serverTransport,
       inputTransportFactory: transportFactory,
       outputTransportFactory: transportFactory,
       inputProtocolFactory: protocolFactory,
       outputProtocolFactory: protocolFactory,
       threadConfig: threadConfiguration,
       loggerFactory.CreateLogger&lt;Startup&gt;());                  
  
  var source = new CancellationTokenSource();                  
  server.ServeAsync(CancellationToken.None).GetAwaiter().GetResult();
  Console.ReadLine();
  source.Cancel();
  </code></pre>