On the server, see what the default is.
Configure high and low write watermarks
Set Sane Write_buffer_high_water_mark and Write_buffer_low_water_mark
Serverbootstrap bootstrap = new Serverbootstrap ();
Bootstrap.childoption (Channeloption.write_buffer_high_water_mark, 32 * 1024);
Bootstrap.childoption (Channeloption.write_buffer_low_water_mark, 8 * 1024);
For instance, imagine you had a queue of tasks on the server side that was filled by clients and processed by backend. In case clients send tasks too quick the length of the queue grows. One needs to introduce so named-Watermark and low watermark. If Queue Length is greater than-watermark stop reading from sockets and queue length would decrease. When the queue length becomes less than low watermark start reading the tasks from sockets again.
Note, to-make it possible-clients to adapt-speed your process tasks (actually to adapt window size) One shouldn ' t ma Ke a big gap between and low watermarks. From the other side small gap means you'll be a too often add/remove sockets from the event loop.
for Netty it seems to be true, Because this javadoc for channelconfig
says:
If The number of bytes queued in the write buffer exceeds writebufferhighwatermark
value,channel.iswritable ()
will start to return false.
And for low watermark:
Once the number of bytes queued in the "write buffer exceeded the high water mark" and then dropped "down below" this value, C Hannel.iswritable () would return true again.
About Sanity, I think, it's relative question, that depends on information that's sending through the channel and H OW often. There is no strict rules for who values you must define for that variables. So, I think, you must found your own values in practice. Slides show one of the examples for that
You can notified for this changes by override the Channelwritabilitychanged (...) method in Channelinboundhandler.
This interface can be implemented to monitor water level changes.
Analysis of Netty4 reading and writing water level control