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