You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Qi <sa...@gmail.com> on 2007/12/06 04:17:42 UTC

Multi-thread/single-session and multi-thread/multi-session, which performances better?

Hi there,

I'm looking to write a client-server application which has a multi-threaded
client (2500+ threads per client). Each thread needs to send and receive
messages with the server, though the sending frequency is pretty low(2-3
messages(of 1k bytes each) per minute per thread). I just wonder which
thread-ioSession mapping model would suit this scenario better?

I'm looking to start this component with MINA 2.0,  could you please also
suggest a consider-to-be-stable revision ?

Cheers,
Qi
-- 
View this message in context: http://www.nabble.com/Multi-thread-single-session-and-multi-thread-multi-session%2C-which-performances-better--tf4953785s16868.html#a14185627
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Multi-thread/single-session and multi-thread/multi-session, which performances better?

Posted by Maarten Bosteels <mb...@gmail.com>.
Hi Qi,

Just out of curiousity, why is the client needing 2500+ threads ?
Is that 2500+ threads in a single JVM ?
I doubt that will be efficient, unless you are running it on a machine
with 500 cores :-)
Let us know how it turns out.

Maarten

On Dec 7, 2007 3:06 AM, Trustin Lee <tr...@gmail.com> wrote:
> Hi Qi,
>
> On Dec 7, 2007 8:31 AM, Qi <sa...@gmail.com> wrote:
> >
> > Hi Trustin,
> >
> > Thank you for your quick reply.
> >
> > Sorry I think I didn't make myself clear, I was intend to ask which model is
> > better for the client side.
> > Since the clients are going to run many threads, will that cause performance
> > issue if all of them are going to share just one IoSession?
>
> For maximum performance, Please maintain the number of connections
> (i.e. IoSessions) to be the same with the number of the I/O processor
> threads.  For example, if the number of I/O processor threads is 4,
> create 4 sessions to utilize all processor threads.
>
> Of course, the recommended number of IoConnector is 1.
>
>
> HTH,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>

Re: Multi-thread/single-session and multi-thread/multi-session, which performances better?

Posted by Trustin Lee <tr...@gmail.com>.
Hi Qi,

On Dec 7, 2007 8:31 AM, Qi <sa...@gmail.com> wrote:
>
> Hi Trustin,
>
> Thank you for your quick reply.
>
> Sorry I think I didn't make myself clear, I was intend to ask which model is
> better for the client side.
> Since the clients are going to run many threads, will that cause performance
> issue if all of them are going to share just one IoSession?

For maximum performance, Please maintain the number of connections
(i.e. IoSessions) to be the same with the number of the I/O processor
threads.  For example, if the number of I/O processor threads is 4,
create 4 sessions to utilize all processor threads.

Of course, the recommended number of IoConnector is 1.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: Multi-thread/single-session and multi-thread/multi-session, which performances better?

Posted by Qi <sa...@gmail.com>.
Hi Trustin,

Thank you for your quick reply.

Sorry I think I didn't make myself clear, I was intend to ask which model is
better for the client side.
Since the clients are going to run many threads, will that cause performance
issue if all of them are going to share just one IoSession? 

Looking forward to see 2.0's release :)

Thanks again,
Qi




Trustin Lee wrote:
> 
> Hi Qi,
> 
> On Dec 6, 2007 12:17 PM, Qi <sa...@gmail.com> wrote:
>>
>> Hi there,
>>
>> I'm looking to write a client-server application which has a
>> multi-threaded
>> client (2500+ threads per client). Each thread needs to send and receive
>> messages with the server, though the sending frequency is pretty low(2-3
>> messages(of 1k bytes each) per minute per thread). I just wonder which
>> thread-ioSession mapping model would suit this scenario better?
> 
> It doesn't depend on the number of clients but depends on what your
> IoHandler does.  If it doesn't interact with any other backends such
> as database which take time, then you are safe to remove all
> ExecutorFilters and disable ThreadModel.  Otherwise, you will need at
> least one ExecutorFilter.
> 
>> I'm looking to start this component with MINA 2.0,  could you please also
>> suggest a consider-to-be-stable revision ?
> 
> I can't.  I want to start a vote for releasing the first milestone though.
> 
> HTH,
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/Multi-thread-single-session-and-multi-thread-multi-session%2C-which-performances-better--tf4953785s16868.html#a14203520
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Multi-thread/single-session and multi-thread/multi-session, which performances better?

Posted by Trustin Lee <tr...@gmail.com>.
Hi Qi,

On Dec 6, 2007 12:17 PM, Qi <sa...@gmail.com> wrote:
>
> Hi there,
>
> I'm looking to write a client-server application which has a multi-threaded
> client (2500+ threads per client). Each thread needs to send and receive
> messages with the server, though the sending frequency is pretty low(2-3
> messages(of 1k bytes each) per minute per thread). I just wonder which
> thread-ioSession mapping model would suit this scenario better?

It doesn't depend on the number of clients but depends on what your
IoHandler does.  If it doesn't interact with any other backends such
as database which take time, then you are safe to remove all
ExecutorFilters and disable ThreadModel.  Otherwise, you will need at
least one ExecutorFilter.

> I'm looking to start this component with MINA 2.0,  could you please also
> suggest a consider-to-be-stable revision ?

I can't.  I want to start a vote for releasing the first milestone though.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6