mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee" <trus...@gmail.com>
Subject Re: Experiences with bulk connections
Date Tue, 24 Oct 2006 02:31:16 GMT
Hi Michael,

On 10/20/06, Michael Bauroth <michael.bauroth@falcom.de> wrote:
> Now the same test needed 450 seconds until success!

1.0 introduced IoServiceListener and maintains the list of sessions for
connectors.  It might be the cause of the problem, but I am not sure yet.  I
think you need to provide us the profiler report.

I changed my code again (move the join() method in an extra step):
> <code>
> ArrayList<ConnectFuture> futurelist = new ArrayList<ConnectFuture>();
> for ( int i = 0; i < 20000; i++)
> {
>      futurelist.add( connector.connect( adr, handler, config ) );
> }
> </code>
> When the list was filled, I started a thread, which should cycle through
> the futurelist as often as there are still unjoined futures available.
> If one future was ready and connected, it was be removed from the list.
> Now the time decreased again to a value of 100-200 seconds.

Actually, that's the right code when you establish massive connections.

I noticed while this tests, that the first futures were removed very
> quickly (hundreds in a few milliseconds), but with ongoing time the rest
> needed more and more time until connect - up to 20 seconds for the last
> 100 connections(!).

This is very weird.  Could you please post a profiling result?  We need to
know where the bottleneck is first.

I changed the test again. Now I used a quartz trigger to establish
> exactly 1 connection per millisecond (1000 per second) without join.
> After 20 seconds this process was finished. When I checked now the
> connected and ready futures, over 19900 were already finished! After
> another 5 seconds all connections were up and running.
> So this test finished after only 25 seconds at all!!!

Are you sure that all operations called from one thread?

My question behind this tests is: Can it be, that Mina has a little
> problem with flooding connection requests? Or do you think, that it is
> the operating system?

MINA calls SocketChannel.connect() in the caller's thread in case the
connection is established right away without needing to get into the
selector loop.  This might take some time at some case, but I'm not sure at
all.  If it takes more than small amount of time, then calling
SocketConnector.connect() multiple times from one thread can take huge
amount of time.

What I really think weird is that last 100 futures takes 20 seconds to

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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message