Hi,

I should be able to contribute the modified thread pool filter in about a week. I'm just working through the legal agreement with my employer just now (this is the first time we will have done this so it is a new process for everyone involved).

In our testing, it is server processes that benefit most from having reads and writes filtered, and only on decent multi-CPU/multi-core machines. This is because you can be encoding and decoding in parallel. I suppose if your encoding is particularly expensive then you will benefit on the client too in some cases but you have to trade off the cost of the context switch.

Robert


"Trustin Lee" <[EMAIL PROTECTED]>

25/03/2006 13:37
Please respond to mina-dev

       
        To:        [email protected]
        cc:        
        Subject:        Re: IoConnectors and Thread Pools



On 3/24/06, Greg Duffy <[EMAIL PROTECTED]> wrote:
>
> Trustin,
>
> I did see that messageSent was being executed in a thread from the
> thread pool. I guess my question is: what is the best way to write a
> multi-threaded client? It seems like things like the protocol encoder
> (which catches filterWrite, I guess) should run in a pooled thread.


Yes, you're right.  Robert says that he modified the ThreadPoolFilter so
IoSession.write() also runs in a thread pool thread.  Let's wait for him for
a while.

Is it up to me to make sure that happens by executing session.write()
> in my own external thread pool? If so, what is the use of a thread
> pool in the IoConnector case, what operations is it speeding up (if
> not the protocol encoder)?


All events are still executed in a thread pool thread, and therefore, your
IoHandler implementation gets benefits from it.  For example, you can write
your messages in sessionOpened() method.

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6



This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

Reply via email to