4 Replies Latest reply on May 20, 2008 3:43 AM by trustin

    Limiting the MINA write queue

    timfox

      One of the issues I have been struggling with the last few days is how to limit the MINA write queue.

      Currently MINA provides an unbounded write queue, so if you write to the session fast enough this can eventually cause RAM to be exhausted, and also increase latency to a unnacceptable level due to the large back log.

      To get around this I added code in MinaHandler to limit the max number of scheduled bytes in the session by blocking when it reached an upper limit, and unblocking when it reached a lower limit.

      The problem with this technique is that if the lower limit is set to zero, then it never unlocks since it appears the scheduled bytes count is not decremented until after the handler method is called.

        • 1. Re: Limiting the MINA write queue
          trustin

          This issue should be fixed with my fix in JBM and MINA. Here's the notable changes I've made:

          * MINA updates scheduledWriteBytes propery *before* calling messageSent.
          * JBM MinaHandler uses suspend/resumeRead() instead of explicit blocking when necessary to avoid dead lock.

          Please let me know if my fix works or not.

          • 2. Re: Limiting the MINA write queue
            trustin

            I'd like to upgrade MINA version that JBM uses, but I don't know how to deploy the latest snapshot jars into repository.jboss.org. Any pointers?

            • 3. Re: Limiting the MINA write queue
              jmesnil

               

              "trustin" wrote:
              I'd like to upgrade MINA version that JBM uses, but I don't know how to deploy the latest snapshot jars into repository.jboss.org. Any pointers?


              I'll upgrade the version to 2.0.0-M2-20080520.004618-19.

              In general to deploy a jar on the repository, the steps are:
              - check out https://svn.jboss.org/repos/repository.jboss.org/apache-mina
              - add the jar in a versioned dir
              - create a component-info.xml file
              - commit everything and it is available a few minutes later on http://repository.jboss.com/apache-mina/.



              • 4. Re: Limiting the MINA write queue
                trustin

                Thanks for the detailed steps. I couldn't imagine that it's being managed under Subversion!