mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Swen Moczarski <m...@swenmoc.de>
Subject OutOfMemory when using ReadThrottleFilter
Date Wed, 03 Jan 2007 21:02:59 GMT
Hi, I have done some performance tests. A client is sending a lot of small messages over a
connection to a server. In 
spite of the read-throttle-filter (org.apache.mina.filter.ReadThrottleFilterBuilder) the server
will be overloaded and I 
get out-of-memory exceptions.

Before the message will be forwarded to the ExecutionFilter, the ReadThrottleFilter makes
use of ByteBuffer.remaining() 
for increasing the calculated size of the connection buffer. But after passing the ExecutionFilter
the method 
ByteBuffer.capacity() is used to decrease the size. Is that behaviour intended?

When I'm patching the ReadThrottleFilterBuilder to use ByteBuffer.capacity() for both cases
the performance test works 
absolutely fine, there are no longer out-of-memory exceptions. BTW, in the SVN-history I have
seen that the first 
version uses ByteBuffer.capacity() for both cases.

I have a second question: Is it correct that for a SocketAcceptor the ReadThrottleFilter have
to add in the session 
created method like this:

   public void sessionCreated(IoSession session) throws Exception {
     ReadThrottleFilterBuilder builder = new ReadThrottleFilterBuilder();
     builder.attach(session.getFilterChain());
   }

This is the first time where the ExecutionFilter is available in the filter chain.


Thanks a lot for any help,
Swen

Mime
View raw message