What OS are you using? CPU usage with sockets is MUCH higher on windows then Linux for instance.

Mike

----- Original Message ----- From: "Richard Lowe" <[EMAIL PROTECTED]>
To: <[email protected]>
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.

Reply via email to