Closed dmnapolitano closed 11 years ago
Ok I think we want a TThreadedSelectorServer
.
Ok, well, I can't tell the difference between what we have currently and the TThreadedSelectorServer
. Seems to perform the same on our cluster. @dan-blanchard :confused:
Did you also get rid of the executorService thing?
Word @dan-blanchard , here's the current version of the code:
TServerTransport serverTransport = new TServerSocket(port);
TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport);
args.maxWorkerThreads(THREAD_POOL_SIZE); // THREAD_POOL_SIZE = 10
args.processor(processor);
args.executorService(new ScheduledThreadPoolExecutor(THREAD_POOL_SIZE));
TServer server = new TThreadPoolServer(args);
and here's what I changed it to:
TNonblockingServerTransport trans = new TNonblockingServerSocket(port);
TThreadedSelectorServer.Args args = new TThreadedSelectorServer.Args(trans);
args.transportFactory(new TFramedTransport.Factory());
args.protocolFactory(new TBinaryProtocol.Factory());
args.processor(processor);
args.selectorThreads(4);
args.workerThreads(32);
TServer server = new TThreadedSelectorServer(args);
Basically directly copied from https://github.com/m1ch1/mapkeeper/blob/eb798bb94090c7366abc6b13142bf91e4ed5993b/stubjava/StubServer.java#L93
And yeah, on the client side, I changed it to use a TFramedTransport
. If you don't use a TFramedTransport
with the latter setup and TBufferedTransport
with the former setup, Thrift just doesn't work. LOL
Ok, running mad things locally as opposed to through the grid. First, with the current setup, it was the same as it ever was, speed-wise (which is rather odd considering the lack of grid overhead, but granted, I am only running 10 TEthreads, lol). Now trying this new-style server, again locally with the 10 threads. So far I've noticed that it starts a million processes. :confused: But, it might always do that...
Ok, here's some timing information. On grid:
Running on one machine, 10 threads of TE:
@dan-blanchard also, just FYI, the only thing the Thrift server is being asked to do is return oneline parse trees of pre-tokenized sentences, one sentence at a time. :smile:
Ok, I'm getting consistently better performance, speed-wise (maybe once we move this into a crazy production environment it'll fall over :smile:) from the TThreadPoolServer
(the current configuration). Increasing the number of threads helps dramatically. Think I'm going to stick with 32 threads and this configuration for now.
See https://github.com/m1ch1/mapkeeper/blob/eb798bb94090c7366abc6b13142bf91e4ed5993b/stubjava/StubServer.java