write buffer low water mark and high water mark setup

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

write buffer low water mark and high water mark setup

meijies
Hi, Community

whether newLowWaterMark is greater than defaultHighWaterMark or not, the
water mark settings are same.  what do you think?

// Low and high water marks for flow control // hack around the
impossibility (in the current netty version) to set both watermarks at
// the same time: final int defaultHighWaterMark =64 *1024; // from DefaultChannelConfig (not exposed) final int newLowWaterMark =config.getMemorySegmentSize() +1; final int newHighWaterMark =2 *config.getMemorySegmentSize(); if (newLowWaterMark > defaultHighWaterMark) {
    bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, newHighWaterMark); bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, newLowWaterMark); }else {// including (newHighWaterMark < defaultLowWaterMark) bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, newLowWaterMark); bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, newHighWaterMark); }

Reply | Threaded
Open this post in threaded view
|

Re: write buffer low water mark and high water mark setup

meijies
sorry ,update the format

whether newLowWaterMark is greater than defaultHighWaterMark or not, the
water mark settings are same.  what do you think?

// Low and high water marks for flow control
// hack around the impossibility (in the current netty version) to set
both watermarks at
// the same time:
final int defaultHighWaterMark =64 *1024; // from DefaultChannelConfig
(not exposed)
final int newLowWaterMark =config.getMemorySegmentSize() +1;
final int newHighWaterMark =2 *config.getMemorySegmentSize();
if (newLowWaterMark > defaultHighWaterMark) {
bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK,
newHighWaterMark);
bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK,
newLowWaterMark);
}else { // including (newHighWaterMark < defaultLowWaterMark)
     bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK,
newLowWaterMark);
bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK,
newHighWaterMark);

}


在 3/26/19 3:12 AM, meijies 写道:

> Hi, Community
>
> whether newLowWaterMark is greater than defaultHighWaterMark or not,
> the water mark settings are same.  what do you think?
>
> // Low and high water marks for flow control // hack around the
> impossibility (in the current netty version) to set both watermarks at
> // the same time: final int defaultHighWaterMark =64 *1024; // from
> DefaultChannelConfig (not exposed) final int newLowWaterMark
> =config.getMemorySegmentSize() +1; final int newHighWaterMark =2
> *config.getMemorySegmentSize(); if (newLowWaterMark >
> defaultHighWaterMark) {
> bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK,
> newHighWaterMark);
> bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK,
> newLowWaterMark); }else {// including (newHighWaterMark <
> defaultLowWaterMark)
> bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK,
> newLowWaterMark);
> bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK,
> newHighWaterMark); }
>
>