Hi,


In the below C# code snippet, you can see how I have built 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:
https://www.nuget.org/packages/ApacheThrift

I have also implemented a gRPC version of this server implementation and in
comparison to gRPC, TThreadPoolAsyncServer's performance (i.e. throughput)
is very low . 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 "Can this be caused by
anything I do incorrectly in below code snippet?" Do you think I am
particularly missing/overlooking st here, which may cause a serious
performance drawback? Many thanks in advance.

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<Startup>());



var source = new CancellationTokenSource();


server.ServeAsync(CancellationToken.None).GetAwaiter().GetResult();

Console.ReadLine();

source.Cancel();



Best Regards,

F. Aydemir

Reply via email to