thrift 小坑

1)TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);  

同时只有一个请求可以访问。 并非会失败

 

 

2)TThreadedServer server(processor, serverTransport, transportFactory, protocolFactory);

每个请求一个线程

 

3)

boost::shared_ptr< PlatformThreadFactory> platformThreadFactory ( new PlatformThreadFactory);
threadManager->threadFactory( platformThreadFactory);
threadManager->start();

// This server allows "workerCount" connection at a time, and reuses threads
TThreadPoolServer server(processor, serverTransport, transportFactory, protocolFactory, threadManager);

工作线程数可控。 但是如果并发超过设置,会有客户端会异常

posted @ 2017-06-12 17:35  thinkcn  阅读(187)  评论(0)    收藏  举报