On Mon, Oct 27, 2008 at 10:42 PM, Ashish <[EMAIL PROTECTED]> wrote:

> What's the value of BUFFER_SIZE? My experience with MINA (2.0)has been
> great, had a UDP Server


I tried various values ranging from the default to 8MB. None helped much,
though.


>
> implementation with 1000+ packets/sec. Since I couldn't afford to
> loose packets, had set the Receive Buffer
> to a high value. Though it ate up a bit of memory, but one can live
> with a few Megs extra usage on 8 GB Server.
>
> BTW, how did you interpreted that your MINA implementation was dropping
> packets?


The client timed out even when the timeout value was 16 seconds and the
server spent less than a second to handle each message. I also ran netstat,
and saw packet losses. There could be other possibilities though, but I
can't think of any for the moment.



>
>
> thanks
>
> On Tue, Oct 28, 2008 at 11:05 AM, Yong Yuan <[EMAIL PROTECTED]> wrote:
> > Hi,
> > My team is considering using MINA UDP to implement our RPC server. The
> > problem is, we saw lots of packet loss when our prototype server tried to
> > handle over 300 messages per second. I thought this was due to overflow
> of
> > UDP's receiving buffer, but increasing the receiving buffer size didn't
> cure
> > the problem. We also wrote a simple server that used plain DatagramSocket
> > and dispatched incoming message to worker threads. This simple server
> worked
> > well under thousands of messages per second even though it implemented
> > exactly the same logic as the MINA version. We're using MINA 1.1.7.
> >
> > My server can be simplified to the following code. The decoder, encoder,
> and
> > IoHandler are very simple. They shouldn't take more than a few million
> > seconds to run. May I know if I have missed anything, or if there is any
> tip
> > or magic trick that I need to be aware of, in order to reduce packet
> losses?
> > Thanks!
> >
> > public static void main(String[] args) throws IOException {
> > DatagramAcceptor acceptor = new
> > DatagramAcceptor(Executors.newCachedThreadPool());
> >
> >
> acceptor.getDefaultConfig().getSessionConfig().setReceiveBufferSize(BUFFER_SIZE);
> > acceptor.getDefaultConfig().getSessionConfig().setReuseAddress(true);
> >  acceptor.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);
> > acceptor.getFilterChain().addLast("threadPool", new
> > ExecutorFilter(Executors.newCachedThreadPool()));
> > acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new
> > MyEncoder(), new MyDecoder()));
> >
> > acceptor.bind(new InetSocketAddress(PORT), new MyHandler());
> > System.out.println("UDP listening on "+PORT);
> > }
> >
> > private static class MyHandler extends IoHandlerAdapter {
> > private MessageHandler handler = new MessageHandler();
> > public void messageReceived(IoSession session, Object message) throws
> > Exception {
> > Message response = handler.execute((byte[])message);
> > session.write(response);
> > }
> >  public void sessionClosed(IoSession session) throws Exception {
> >  session.close();
> >  }
> >  }
> >
>
>
>
> --
> thanks
> ashish
>
> Blog: http://www.ashishpaliwal.com/blog
>
> My Photo Galleries: http://www.pbase.com/ashishpaliwal
>

Reply via email to