users@grizzly.java.net

Re: Using multiple selector handlers on the client side

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 14 Oct 2008 10:34:14 -0400

Salut,

sorry for the dealy...Alexey and I were on vacation.

Tomasz Kowalczewski wrote:
> Hello,
>
> I have a question related to usage of multiple (TCP)SelectorHandler-s on
> the client side. Does this provide any performance benefit when having
> client implementation that keeps connections to many servers (and 2-3
> connections to each server)? Normally I would presume that having
> multiple selectors would help, but looking at grizzly implementation I
> see that:

Multiple Selector should not help when you only have 2 or 3 (less than
1000 IMO).


>
> 1) TCPSelectorHandler javadoc says: "One or more instance of a Selector
> are handled by SelectorHandler" and yet I cannot see this in code - it
> handles only one selector.

Have you looked at:

https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/RoundRobinSelectorHandler.html

> 2) When creating new connector handler by
> "controller.acquireConnectorHandler( Protocol.TCP )" I can track this
> down to DefaultConnectorHandlerPool class which calls back to
> controller.getSelectorHandler(protocol). This method always returns
> first SelectorHandler on a list that supports given protocol.

I see. Let me refresh my mind on that. but I would think you should use
the RounRobinSelectorHandler, which in term should use a pool of
Selector instead of always picking up the first one. Again, I need to
spend some time look at the code :-) What do you think?

A+

-- Jeanfrancois


>
> Waiting for your input.
>
> Thanks,
> Tomasz