Could someone please respond and let me know regarding this? 

i checked after running a test-case by completely blocking the receive in 
the server. netty is basically used as a proxy between the client and 
server. The client kept sending a message in a loop and the message was 
also printed out to System.out along with a counter. The client eventually 
stops sending any more messages. The proxy keeps forwarding these messages 
and "never" becomes unwritable, nor does the bytebeforeunwritable decrease

I have also posted this question on SO, but the answer that I have received 
does not match my testing, so I would like to understand further.


I will really appreciate any response.

Thanks
Nipun


On Sunday, March 12, 2017 at 8:18:32 PM UTC-4, Nipun Arora wrote:
>
> I am trying to understand netty and it's relationship with TCP Flow 
> control (since it has non-blocking I/O).
> Also, I am trying to understand, outbound channel buffer's use and 
> watermarks. How does it come into play if I only use WriteandFlush().
>
> As a test case, I have a netty server which writes to a client, the client 
> is blocked (essentially has a sleep of 10 seconds between each read)
>
> - Under normal I/O TCP sender would be throttled (sending is slowed down 
> because of flow control) if the receiver is blocked, this is not the case 
> here. The sender seems to keep writing and flushing data on each send. 
> Where is this data being written? Is there going to be Flow control in the 
> netty's flush() as well? 
> See: 
> https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Flow_control
>
> - Is it is being written to an OS or TCP buffer, does netty channel have 
> an internal buffer as well? If so how can I configure it?
>
> - I track bytesBeforeUnwritable but they do not seem to be decreasing even 
> after sending a lot of data. (I only use writeandflush() )
>
> - What is the default High and Low Watermark? I have not set anything in 
> my application. Is there any way to use this instead?
>
>
> Code below:
>
>      @Override
>         public void channelRead(final ChannelHandlerContext ctx, Object 
> buf) {
>     if (server3OutboundChannel.isActive()) {
>                 server3OutboundChannel.writeAndFlush(msg)
>                         .addListener(new ChannelFutureListener() {
>                     @Override
>                     public void operationComplete(ChannelFuture future) {
>                         if (future.isSuccess()) {
>                             // was able to flush out data, start to read 
> the next chunk
>                             System.out.println(server3OutboundChannel.
> bytesBeforeUnwritable());
>                             ctx.channel().read();
>                         } else {
>                             future.channel().close();
>                         }
>                     }
>                 });
>             }
>     }
>
>
> Could anyone please let me know?
>
> Thanks
> Nipun
>

-- 
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/6e869603-1a01-473c-af34-774ba97345fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to