users@grizzly.java.net

Optimal IOStrategy/ThreadPool configuration for proxy

From: Daniel Feist <dfeist_at_gmail.com>
Date: Sat, 11 Apr 2015 00:36:10 +0100

Hi,

Just wondering what the optimal configuration for a HTTP proxy is:

i) Use SameThreadIOStrategy for inbound and outbound. This one I'm clear
on.

ii) Is using the same Grizzly Transport instance important or significant?
I assume not.

iii) If not using the same transport, is using the same selector threadPool
for both inbound and outbound grizzly transports beneficial, important or
makes no difference.?

(Using AHC for outbound means sharing the Transport instance isn't really
an option, but sharing the same selector threadPool could be an option.)

A couple of other comments/questions:

- When using AHC it would appear that even if both inbound/outbound are
using the same selector pool, a thread handover will still occur because
AHC obtains the outbound connection asynchronsouly using the outbound
selector threadPool and then sends the request using that same thread. This
right?
- Even if the same selector pool is configured for inbound and outbound,
during response processing then Grizzly will still do a thread handover
before sending response to client because of the use of AsyncQueueIO. This
right?

Once I complete my changes I'll have:

*request*: Client -> Inbound Selector -> (Optional Worker X) -> Outbound
Selector - > Target Service
*response:* Target Service -> Outbound Selector -> (Optional Worker X) ->
Inound Selector - Client.

(Note: the optional workers woud come from the same Exectuor)

Make sense? Or should I ideally be looking to by using 1 thread each way
rather than the minimum two I'd have with default AHC/Grizzly behaviuor
observed and describied above.

Dan