Version 12

    Message Softening

     

    This mechanism allows JBossMQ to clear memory used by jms messages to avoid OutOfMemoryError. It cannot help if memory is used by something else.

     

    When the JVMs heap size passes the HighMemoryMark and starts to approach the MaxMemoryMark the MessageCache begins softening

    messages. This involves converting hard referenced messages to SoftReferences in memory and writing a

    persistent copy of the message to the CacheStore. Messages are softened using a least recently used

    algorithm. The closer you get to the MaxMemoryMark the more aggressive it is at softening

    messages.

     

    If memory does become tight, the JVM can clear the soft references, forcing the next access to the message

    to retrieve the persistent copy. The check is run on every addition of message and periodically using a

    background thread.

     

    NOTE: Even though a SoftReference is kept in memory (avoiding CacheStore access), when the message is

    acknowledged after delivery, the persistent copy needs to be deleted.

     

    NOTE: There is no way to automatically configure the High and Max memory mark. Most JVMs do not reliably

    report the total available heap until it has been fully allocated. *The default settings are for the default Sun JVM

    memory allocation of 64M i.e. 50/60M which is almost certainly wrong if you have more memory*.

     

    Typical settings for for soft/hard should be 80% and 90% of the -xmx setting.

    You need to leave room (10% of memory if you set 90% for the max setting)  to make sure there is spare memory to cope with any large messages you send.