Hi

This sounds similar to a problem that we encountered where mina was serving multiple sessions and forwarding to a single connection, similar to your environment. We found that the thread management in mina on the single connection side would not work efficiently and end up only allocating jobs to a single thread. This effectively caused the jobs to be executed sequentially, which in turn caused the backlog and memory buildup. I suspect that the issue is related to there only being a single connection on the IoConnector as we found that the jobs were allocated correctly across threads on the IoAcceptor side.

We worked around it by removing the thread pool from the mina filter chain and implementing our own thread management just outside the mina interface.

Paddy

mat wrote:
Thanks a lot.

My server has one client (using mina too) connecting to a data source(20 -
30 /sec incoming messages) and the other side is server listening on one
port to broadcasting messages to end users(I wish Mina could handle 1000+
concurrent users). No other heaving loading process.

If the incoming messages is not fast, I don't think i need a
ReadThrottleFilter, right?


The following are the part of write method:(I am sure not the write problem
since normally no user connected OOM also happened, however you can point
out why Future.join helps here. ^^)

synchronized(sessions)
       {
  ByteBuffer buf = ByteBuffer.allocate(512);
  buf.setAutoExpand(true);

  Object message = serviceMessage.getMessage();

  if (!(message instanceof byte[]))
   return;

  buf.put((byte[])message);
  buf.flip();

  Iterator iter = sessions.values().iterator();

           while(iter.hasNext())
           {
            IoSession session = (IoSession) iter.next();
      session.write(buf.duplicate());
           }
       }


On 7/20/07, Luis Neves <[EMAIL PROTECTED]> wrote:

Hi,

mat wrote:
> My server sometimes faced "OOM" problem. (I couldn't profile it since
TPTP
> crashed my server before OOM occured). I didn't see major memory leak
when
> profiling. Therefore, I believe OOM happens when READ or WRITE operation
> can't handle the incoming messages or outgoing messages. (However my
> incoming messages normally 20 * 512bytes/sec, NOT too fast, right?).
Last
> time i saw my server memory usage is over 600MB in windows XP.

Your code is broken ... the question is where. Mina can handle that amount
of
messages without breaking a sweat.
Do you have some kind of heavy processing in the receiving end that delays
the
acceptance of messages?

Did you try to use the ReadThrottleFilter?
How are you doing you writes?
A simple "iosession.write()" ?
Did you try something like:
WriteFuture wf = iosession.write();
wf.join();

Can we see the code of your Encoder/Decoder?


--
Luis Neves




Reply via email to