Emmanuel Lecharny wrote:
Daniel John Debrunner wrote:

I'm seeing hangs when I use an IoEventQueueThrottle as below. I read the comments in the javadoc about requiring an executor in the filter chain. I get no hangs if I do not add "writeThrottle" into the chain (my app is currently throttling by waiting for every 100th write to complete).

// Setup
NioSocketConnector connector = new NioSocketConnector();
connector.getFilterChain().addFirst("executor", new ExecutorFilter(1));
connector.getFilterChain().addLast("writeThrottle",
    new WriteRequestFilter(new IoEventQueueThrottle(10)));


// message sennding

IoBuffer buf = prepareBuffer();

WriteFuture wf = session.write(buf);

Are there any examples of how to use IoEventQueueThrottle for write throttling?

The problem is that you probably have a slow client. Even if you use a throttling mechanism, you will block one thread until all the write is done.

I don't think so. Without the "writeThrottle" in the filter chain I see 8000-20000/sec messages sent from the above code to a mina server (2.0 M6). Adding the "writeThrottle" leads to a hang, no messages seen by the client.


That would be good for sure to have such a mechanism implemented in MINA... This is not exactly what does the IoEventQueueThrottler : it does limit the size of data sent to the client to a certain size, limiting the throughput. Probably not what you want.

So the threshold parameter to IoEventQueueThrottler constructor is number of bytes, not number of messages?

Thanks,
Dan.

Reply via email to