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