users@grizzly.java.net

Re: Performance improvement in TCP connection threading

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Wed, 29 May 2013 11:33:23 -0700

Hi Eric,


On 29.05.13 02:12, PEIFFER, ERIC (ERIC) wrote:
> Hi,
> I have wrote a IMAP4 server using grizzly 1.9.45
> I try to optimize the threading that is in charge to read the TCP
> connection
> Actually I set the ReadThreadCount property in the Controller class to
> 5 ( I'm not sure of the behaviours of this members and what is its role):
> setReadThreadsCount(5);
> I have tried to set a thread pool using setThreadPool method of the
> SelectorHandler class.
> Here is the code that I wrote:
> SelectorHandler selectorHandler;
> .....
> DefaultWorkerThreadFactory threadFactory = new
> DefaultWorkerThreadFactory();
> ExecutorService executorService =
> Executors.newFixedThreadPool(5, threadFactory);
> threadFactory.setWorkerThreadFactory(executorService);
> selectorHandler.setThreadPool(executorService);
> But I can not see any improvement of performance
It should be enough to setReadThreadsCount to 5, no need to set actual
ThreadPool, because Grizzly can create its own ThreadPool of given size.
It might be good to see what is the default thread pool size configured
in your server. Can you pls. send your server's jstack dump ($jstack <PID>).

I'd also recommend to use Grizzly 2.3, IMO it is much easier to use. If
you can share your Grizzly related code (you can send it me privately) I
can try to help you migrate it to 2.x.

Thanks.

WBR,
Alexey.

> What is the best way in order to improve the performance of the thread
> that are in charge to read the TCP connect.
> regards
> Eric Peiffer.