UDP problem sending byte768 bytes

Neil Avery neil at liquidlabs.co.uk
Fri Jun 26 17:26:22 EDT 2009


Oops - forgot to add my point - thats our particular use case - so 768 is
probably ok for most cases!
Cheers.

2009/6/26 Neil Avery <neil at liquidlabs.co.uk>

> We are using it (udp) to burst a search request to hundreds or thousands of
> machines. Sending using TCP degrades as more machines are added to the
> network - even when using our custom connection pooling we still see
> degradation - using udp provides much better performance (and we cannot use
> multicast). Our message size is a maximum of 5K, - btw - we use netty tcp
> elsewhere when reliablity is required.
> Cheers Neil.
>
> 2009/6/26 "이희승 (Trustin Lee)" <trustin at gmail.com>
>
> By the way, please let me know if you think the default (768) is not sane
>> and should be increased.  I'm not really a UDP expert so other people's
>> suggestion is appreciated.
>>
>> Thanks
>>
>> 이희승 (Trustin Lee) wrote:
>>
>>> Hi Neil,
>>>
>>> It's because the default receiveBufferSizePredictor of DatagramChannel
>>> is FixedReceiveBufferSizePredictor(768).  You can configure the channel
>>> to a FixedReceiveBufferSizePredictor with different payload size.  For
>>> example:
>>>
>>>   DatagramChannel ch = ...;
>>>   ch.getConfig().setReceiveBufferSizePredictor(
>>>           new FixedReceiveBufferSizePredictor(1024));
>>>
>>> or:
>>>
>>>   ConnectionlessBootstrap b = ...;
>>>   b.setOption("receiveBufferSizePredictor",
>>>               new FixedReceiveBufferSizePredictor(1024));
>>>
>>> BTW, I wouldn't recommend to using AdaptiveReceiveBufferSizePrediector
>>> for datagrams.
>>>
>>> HTH,
>>> Trustin
>>>
>>> On 2009-06-25 오전 4:49, neilson9 wrote:
>>>
>>>> Hi,
>>>>
>>>> Im having a couple of problems sending UDP byte[]>  768K
>>>>
>>>> For example if Im passing 1024bytes the buffer.readIndex does not get
>>>> updated. The sender only passes 768 bytes and if I manually set the
>>>> readIndex to 768 it sends another 768 bytes on the second send. I would
>>>> like
>>>> to iterate of the byte[] and use the offsets to prevent copying data
>>>> etc.
>>>>
>>>> Any help appreciated.
>>>> Regards Neil.
>>>>
>>>> For example:
>>>>                  byte[] payload = userdata....;
>>>>
>>>>                 channel = (DatagramChannel) b.bind(new
>>>> InetSocketAddress(0));
>>>>                 ChannelBuffer buffer = dynamicBuffer(bytes.length);
>>>>                 buffer.writeBytes(bytes);
>>>>                 LOGGER.info("Sending:" + bytes.length + " sent:" +
>>>> buffer.readerIndex());
>>>>                 ChannelFuture channelFuture = channel.write(buffer, new
>>>> InetSocketAddress(uri.getHost(), port));
>>>>                  // manually setting to see if it sends the remainder
>>>>                 buffer.readerIndex(768);
>>>>
>>>>                 channelFuture = channel.write(buffer, new
>>>> InetSocketAddress(uri.getHost(), port));
>>>>                 LOGGER.info("Sending:" + buffer.readerIndex());
>>>>
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> netty-users mailing list
>>> netty-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>>
>>
>> --
>> Trustin Lee, http://gleamynode.net
>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090626/c9bc9fff/attachment.html 


More information about the netty-users mailing list