mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard <rjt-m...@thegrindstone.me.uk>
Subject tuning app with large number of UDP sessions
Date Fri, 17 Oct 2008 09:03:52 GMT
Hi

I am new to MINA and I have a slightly unusual application. I am hoping
that someone can give me some advice on the best way to optimise MINA's
performance.

I have a server for a UDP protocol for which I have implemented a
handler, decoder, encoder etc. The server works just fine.

But I want to run the protocol on a large number of UDP ports to support
 lots of clients, each with their own port number for talking to my
server. (I would not have designed it this way, but I do not have
control of the client implementation).

So I took the, possibly naive, approach of just looping over the
following code many times to start lots of listeners:


acceptor = new DatagramAcceptor();
acceptor.getDefaultConfig().getSessionConfig().setReuseAddress(true);

DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
		chain.addLast("", new LoggingFilter());
		chain.addLast("codec", new ProtocolCodecFilter(						new CodecFactory()));
		acceptor.bind(new InetSocketAddress(udp_port), new Handler(this));

The only other MINA options that I am setting are:

ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());

Using this approach I am able to create 250 instances of my server
before I start to get errors. I think that the errors are either file
descriptor limits or memory problems because of the number of threads
that are being created ~500.

Can anyone offer any advice on how I can best setup MINA to handle this
type of application? I would like to listen on 1000+ UDP ports.


Many thanks

Richard


Mime
View raw message