Parvesh Garg
2017-07-14 08:18:11 UTC
Hi,
I have a basic question about how the oneway method called from client work
with TThreadPoolServer. We have a server written in C++ that uses thread
pool server with 4 threads. The client in python connects only once and
keep pushing data to server using a oneway method. Our doubt is will the
server queue the events and process them in a single thread or spawn
multiple threads to take care of each event?
Client is single threaded.
Thrift version is 0.10.0
Here is a glimpse of code showing how the server is configured.
int main(int /*argc*/, char ** /*argv*/) {
boost::shared_ptr<AppServerHandler> handler(new AppServerHandler());
boost::shared_ptr<TProcessor> processor(new AppServerProcessor(handler));
int port_b = 9090;
boost::shared_ptr<TServerTransport> serverTransport_b(new
TServerSocket(port_b));
boost::shared_ptr<TTransportFactory> transportFactory_b(new
TBufferedTransportFactory());
boost::shared_ptr<TProtocolFactory> protocolFactory_b(new
TBinaryProtocolFactory());
boost::shared_ptr<ThreadManager> threadManager_b =
ThreadManager::newSimpleThreadManager(4);
boost::shared_ptr<PosixThreadFactory> threadFactory_b(new
PosixThreadFactory());
threadManager_b->threadFactory(threadFactory_b);
threadManager_b->start();
TThreadPoolServer server_b(processor, serverTransport_b,
transportFactory_b,
protocolFactory_b, threadManager_b);
server_b.serve();
return 0;
}
Happy to provide more details if needed.
Thanks,
Parvesh Garg
I have a basic question about how the oneway method called from client work
with TThreadPoolServer. We have a server written in C++ that uses thread
pool server with 4 threads. The client in python connects only once and
keep pushing data to server using a oneway method. Our doubt is will the
server queue the events and process them in a single thread or spawn
multiple threads to take care of each event?
Client is single threaded.
Thrift version is 0.10.0
Here is a glimpse of code showing how the server is configured.
int main(int /*argc*/, char ** /*argv*/) {
boost::shared_ptr<AppServerHandler> handler(new AppServerHandler());
boost::shared_ptr<TProcessor> processor(new AppServerProcessor(handler));
int port_b = 9090;
boost::shared_ptr<TServerTransport> serverTransport_b(new
TServerSocket(port_b));
boost::shared_ptr<TTransportFactory> transportFactory_b(new
TBufferedTransportFactory());
boost::shared_ptr<TProtocolFactory> protocolFactory_b(new
TBinaryProtocolFactory());
boost::shared_ptr<ThreadManager> threadManager_b =
ThreadManager::newSimpleThreadManager(4);
boost::shared_ptr<PosixThreadFactory> threadFactory_b(new
PosixThreadFactory());
threadManager_b->threadFactory(threadFactory_b);
threadManager_b->start();
TThreadPoolServer server_b(processor, serverTransport_b,
transportFactory_b,
protocolFactory_b, threadManager_b);
server_b.serve();
return 0;
}
Happy to provide more details if needed.
Thanks,
Parvesh Garg