mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <jvermill...@gmail.com>
Subject Re: NIO UDP server, does it make sense at all ?
Date Fri, 24 May 2013 18:54:01 GMT
I'll try to do a bio based UDP server from what I already have.
Thanks for the feedback.
Le 24 mai 2013 17:21, "Emmanuel Lécharny" <elecharny@gmail.com> a écrit :

> Le 5/24/13 4:53 PM, Julien Vermillard a écrit :
> > Hi,
> > I just conducted some NIO vs BIO on UDP server.
> >
> > For a UDP server you need only one socket, not like for TCP (with
> > spawn anew socket for each client session).
> >
> > So if you try to detect I/O events with NIO select(); on your only one
> > socket you pay a hugr price for detecting events.
> >
> > With the MINA 3 CoAP codec, I managed to have 20k msg/sec on my laptop
> > (mina or netty NIO) but with a basic BIO client/server implementation
> > it jumped to 100k msg/sec (with both client and server on my laptop).
>
> Crystal clear : select() is a huge penalty to pay when using a
> DatagramChannel.
>
> I asn't expecting teh gap to be that huge though...
> >
> >
> > I start to think a NIO based UDP server is pointless and we should not
> > try to provide one, but a good BIO based one.
>
> We do need a decent BIO implementation for both UDP *and* TCP. My
> understanding is that TCP over BIO will be 30% faster than over NIO, the
> only valid reason to use NIO is when you have tens of thousands
> connected users (well, you don't want to spawn as many threads as you
> have conected users, don't you ?)
>
> So bottom line, it's probably a good idea to provide a BIO based
> transport for TCP and UDP.
>
> The question you raise is pretty much  : should the user *know* if it's
> using NIO or BIO ? I'm not convinced it's a valid concern for the user,
> and I do think we can safely make a choice for him (through some
> configuration, like we default to BIO for both TCP and UDP, unless the
> user explicitely requests to use NIO).
>
> Does it sounds sane ?
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message