Thank you Norman.
Can you please be so kind and also address the the OutOfMemory situation 
described here https://github.com/netty/netty/issues/9036?
I am looking for a reliable way to back-pressure the producing loop (and 
not reach an OOM), but be as efficient with the sending as possible.

On Monday, April 15, 2019 at 7:52:07 AM UTC+2, Norman Maurer wrote:
>
> Yes exactly like this
>
> Am 12.04.2019 um 08:19 schrieb Frederic <[email protected] <javascript:>>:
>
> You can create one buffer and then use to send to all your sockets the 
> very same buffer content but using different indexes (read here) using the 
> ByteBuf.duplicate() method.
>
> https://netty.io/4.1/api/io/netty/buffer/ByteBuf.html#duplicate--
>
> Javadoc says:
>
>
> public abstract ByteBuf 
> <https://netty.io/4.1/api/io/netty/buffer/ByteBuf.html> duplicate()
>
> Returns a buffer which shares the whole region of this buffer. Modifying 
> the content of the returned buffer or this buffer affects each other's 
> content while they maintain separate indexes and marks. This method does 
> not modify readerIndex or writerIndex of this buffer.
>
> The reader and writer marks will not be duplicated. Also be aware that 
> this method will NOT call retain() 
> <https://netty.io/4.1/api/io/netty/buffer/ByteBuf.html#retain--> and so 
> the reference count will NOT be increased.
> Returns:A buffer whose readable content is equivalent to the buffer 
> returned by slice() 
> <https://netty.io/4.1/api/io/netty/buffer/ByteBuf.html#slice-->. However 
> this buffer will share the capacity of the underlying buffer, and therefore 
> allows access to all of the underlying content if necessary.
>
> Le vendredi 12 avril 2019 06:31:57 UTC+2, [email protected] a écrit :
>>
>> Are there any optimizations available if I'd like to send the very same 
>> data to dozens (or hundreds) of Websocket channels?
>> At a minimum I'd like to avoid creating (and copying) the data to new 
>> buffers. Ideally I would provide a single buffer and a list of channels.
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/netty/4c93f31c-a1f0-48be-94ef-b7cda094e2c5%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/netty/4c93f31c-a1f0-48be-94ef-b7cda094e2c5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/889659ce-68fa-4622-825e-c05c7328079c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to