Fixing a Memory Problem in the Default Tolven Configuration

Healthcare Solutions Forums Tolven Platform Support Fixing a Memory Problem in the Default Tolven Configuration


This topic contains 0 replies, has 1 voice, and was last updated by  D.J. Jacob 3 years, 8 months ago.

Viewing 1 post (of 1 total)
  • Author
  • #340

    D.J. Jacob

    The default Stateless Session Bean pooling configuration in JBoss (and thus, Tolven) is ThreadLocalPool. This means that each running thread gets its own pool of Stateless Session Beans. However, these pools do not get cleaned up when a thread terminates. Tolven uses JMS messaging for document queueing and processing. JMS creates a new thread to process each message. Over time, as documents are submitted and processed in Tolven, a new thread, and thus a new pool of Stateless Session Beans is created for each document. Since these pools aren’t cleaned up after the thread terminates, this creates a slow memory leak.

    The solution is to change the pooling configuration for Stateless Session Beans to use StrictMaxPool instead. The StrictMaxPool is shared across all active threads, and has a maximum size. One disadvantage to the StrictMaxPool is that if the max size is not set correctly, it can cause a performance bottleneck as threads will block while they are waiting on a Stateless Session Bean to become available. In practice, however, we have found that Tolven doesn’t demand a high max size, and the default value of 30 is sufficient. Larger scale deployments might require a higher maximum size, but this is an easy configuration change.

    To change the pooling configuration, open ejb3-interceptors-aop.xml in the tolven-jboss6\server\tolven\deploy directory. Look for the domain named “Stateless Bean”. Change the annotation from

    <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
        @org.jboss.ejb3.annotation.Pool (value="ThreadLocalPool", maxSize=30, timeout=10000)


    <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
        @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=30, timeout=10000)

    Restart JBoss to make the change take effect. Note that the max size and timeout for the pool are also configured in this same location.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Innovative solutions for healthcare using open source technologies