You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Michael Grundvig <mi...@electrotank.com> on 2007/04/19 16:14:19 UTC
Re: 1000+ simultaneous connections with data transfer?
What OS are you using? CPU usage with sockets is MUCH higher on windows then
Linux for instance.
Mike
----- Original Message -----
From: "Richard Lowe" <mi...@webcogs.com>
To: <de...@mina.apache.org>
Sent: Thursday, April 19, 2007 9:14 AM
Subject: 1000+ simultaneous connections with data transfer?
> Hi All,
>
> I am using Mina 1.0.0 under JRE 1.4.2 and testing it using a simple server
> and client program that I have written. I must say that Mina is
> excellent, the API is very easy to work with. I have a performance
> question and am hoping that you guys might be able to supply me with an
> answer.
>
> My server program starts up and waits for connections on a predesignated
> TCP port (I use a class that extends IOHandlerAdapter to send events to my
> server thread). Every 1/4 of a second it will write ~ 128 bytes of data
> to every connected session if the connection is a new session *or* the
> session has successfully responded to a previous 128 byte packet with a 64
> byte packet of its own. I use the following tweaks to help improve
> performance:
>
> ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
> ByteBuffer.setUseDirectBuffers(false);
>
> My client program (running on a seperate machine) creates 1000 instances
> of an IoHandlerAdapter. Every time it receives a 128 byte packet from the
> server, it immediately responds with a 64 byte packet.
>
> To summarise, I'm sending 128 bytes per session every 1/4 of a second to
> which I am receiving 64 bytes back.
>
> The test 'server' (more accurately desktop) is an AMD Athlon 3200+ (so not
> the most powerful) and I am getting around 75% CPU utilisation with 1000
> connections.
>
> More specifically:
>
> 100: 4%, 200: 10%, 300: 22%, 400: 38%, 500: 43%, 600: 58%, 700: 65%, 800:
> 66%, 900: 70%, 1000: 75%
>
> The bottleneck seems to be in the Mina layer or below. Is the performance
> above what you would consider to be 'optimal' or is there an obvious way
> of substantially reducing CPU load?
>
> Ideally I would love to support 2000+ simultaneous connections on this
> test machine. Is there a way of achieving this without my CPU fan flying
> off it's spindle and my machine setting alight?
>
> Any advice that you can offer would be very much appreciated!
>
> Cheers,
> Richard.
Re: 1000+ simultaneous connections with data transfer?
Posted by Richard Lowe <mi...@webcogs.com>.
Hi Mike,
Thank you for getting back to me and apologies for not including the OS
in my original message - the OS is Windows XP.
I have just tried the server on a Fedora Linux box (the CPU is very
roughly about 30% slower than on the XP box) and unfortunately the load
average is about 2.0 whilst the %CPU for the java process is at about
70%. I don't know if that helps to provide any clues or not.
Many thanks,
Richard.
--
Michael Grundvig wrote:
> What OS are you using? CPU usage with sockets is MUCH higher on
> windows then Linux for instance.
>
> Mike
>
> ----- Original Message ----- From: "Richard Lowe" <mi...@webcogs.com>
> To: <de...@mina.apache.org>
> Sent: Thursday, April 19, 2007 9:14 AM
> Subject: 1000+ simultaneous connections with data transfer?
>
>
>> Hi All,
>>
>> I am using Mina 1.0.0 under JRE 1.4.2 and testing it using a simple
>> server and client program that I have written. I must say that Mina
>> is excellent, the API is very easy to work with. I have a
>> performance question and am hoping that you guys might be able to
>> supply me with an answer.
>>
>> My server program starts up and waits for connections on a
>> predesignated TCP port (I use a class that extends IOHandlerAdapter
>> to send events to my server thread). Every 1/4 of a second it will
>> write ~ 128 bytes of data to every connected session if the
>> connection is a new session *or* the session has successfully
>> responded to a previous 128 byte packet with a 64 byte packet of its
>> own. I use the following tweaks to help improve performance:
>>
>> ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
>> ByteBuffer.setUseDirectBuffers(false);
>>
>> My client program (running on a seperate machine) creates 1000
>> instances of an IoHandlerAdapter. Every time it receives a 128 byte
>> packet from the server, it immediately responds with a 64 byte packet.
>>
>> To summarise, I'm sending 128 bytes per session every 1/4 of a second
>> to which I am receiving 64 bytes back.
>>
>> The test 'server' (more accurately desktop) is an AMD Athlon 3200+
>> (so not the most powerful) and I am getting around 75% CPU
>> utilisation with 1000 connections.
>>
>> More specifically:
>>
>> 100: 4%, 200: 10%, 300: 22%, 400: 38%, 500: 43%, 600: 58%, 700: 65%,
>> 800: 66%, 900: 70%, 1000: 75%
>>
>> The bottleneck seems to be in the Mina layer or below. Is the
>> performance above what you would consider to be 'optimal' or is there
>> an obvious way of substantially reducing CPU load?
>>
>> Ideally I would love to support 2000+ simultaneous connections on
>> this test machine. Is there a way of achieving this without my CPU
>> fan flying off it's spindle and my machine setting alight?
>>
>> Any advice that you can offer would be very much appreciated!
>>
>> Cheers,
>> Richard.
>