Ok, I completed it,
feedback welcome :)
--
Julien Vermillard :::: http://people.apache.org/~jvermillard/


On Sun, May 26, 2013 at 5:18 PM, Julien Vermillard
<jvermill...@gmail.com> wrote:
> I started to introduced a BIO based UDP server. I moved around a lot of code.
> Julien Vermillard :::: http://people.apache.org/~jvermillard/
>
>
> On Fri, May 24, 2013 at 8:54 PM, Julien Vermillard
> <jvermill...@gmail.com> wrote:
>> 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" <elecha...@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
>>>
>>

Reply via email to