Throtteling for proxies.

Sebastian Andersson bofh69 at gmail.com
Fri Nov 27 09:07:35 EST 2009


Hi there!

I've made a proxy with netty. It sits between a server that sends data
as fast as it can (until its buffers are full) and a client.
Since the proxy may have a better network connectivity to the server
than the client has to the proxy, I need to throttle the reading of
the server's channel, otherwise the client's channel would fill up
with data.

I'm guessing I would have to solve this with a new class inheriting
SimpleChannelHandler and overriding writeRequested and writeComplete
to measure the queue size and call the server's channel's setReadble.
In this case its important to have an even flow, so I will just change
the readability for every event depending on the current queue size
(and I'll have a rather small queue size).

But where does the queue end up? Is there a queue between each
ChannelHandler? In that case I should perhaps have two such
ChannelHandlers, one in each end, to prevent a slow protocol encoder
from building up a queue in the middle of the pipeline.

/Sebastian
-- 
One laptop per child project: http://laptop.org/


More information about the netty-users mailing list