Return-Path: Delivered-To: apmail-mina-users-archive@www.apache.org Received: (qmail 34112 invoked from network); 17 Oct 2008 09:04:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Oct 2008 09:04:23 -0000 Received: (qmail 4536 invoked by uid 500); 17 Oct 2008 09:04:24 -0000 Delivered-To: apmail-mina-users-archive@mina.apache.org Received: (qmail 4525 invoked by uid 500); 17 Oct 2008 09:04:24 -0000 Mailing-List: contact users-help@mina.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@mina.apache.org Delivered-To: mailing list users@mina.apache.org Received: (qmail 4510 invoked by uid 99); 17 Oct 2008 09:04:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2008 02:04:24 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.23.3.141] (HELO smarthost02.mail.zen.net.uk) (212.23.3.141) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2008 09:03:16 +0000 Received: from [82.68.127.150] (helo=wiki.bee.taylor.home) by smarthost02.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1KqlFQ-0001xk-Mm for users@mina.apache.org; Fri, 17 Oct 2008 09:03:52 +0000 Message-ID: <48F854F8.7070308@thegrindstone.me.uk> Date: Fri, 17 Oct 2008 10:03:52 +0100 From: Richard User-Agent: Thunderbird 2.0.0.17 (Macintosh/20080914) MIME-Version: 1.0 To: users@mina.apache.org Subject: tuning app with large number of UDP sessions Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Originating-Smarthost02-IP: [82.68.127.150] X-Virus-Checked: Checked by ClamAV on apache.org 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