Reputation: 4698
In order to prevent OOME in a riemann server when clients do not read ACKs properly, I have implemented some logic to close the channel when it becomes unwritable, under the assumption this is caused by client not reading/ACKing packets quickly enough.
However, this also closes the channel when sending large-ish query results, probably because the server tries to write the result faster than it can be sent through TCP. Out of the top of my head, I would think the best way to handle this situation would be to set some timeout on writing, using a WriteTimeoutHandler.
Is there some standard pattern known in netty to handle that case?
Upvotes: 2
Views: 755
Reputation: 23557
Basically you would stop writing once Channel.isWritable()
returns false and start again once it returns true again. You can be notified by the update of this by overriding ChannelInboundHandler.channelWritabilityChanged(...)
.
Upvotes: 1