Big savings in Openfire Memory Consumption

Hi,

I have checked the forums for this issue/fix and haven’t found any

We are using openfire to send messages varying in size from 1k-9k and we found situations where openfire was dumping heap due to out of memory errors.

The issue seems to be that openfire is retaining the last message sent to it, through the LeafNode object, which in turns holds the raw string + the DOM reporesentation of the broken down XML message.

In this particular case, the application was creating up front nodes (52K of them) and at some point of time all of those nodes get messages, and the last message is retained.

We found that disabling the storing of the message in the leafNode object (setLastPublishedItem(newItem)) fixed the issue. The memory consumption dropped to about 256Mb from 1400MB which was quite astonishing, (coupled with some settings to fasten things up a bit, found from the forums)

it seemed to us, that the lastmessage sent through a node is used only when creating a new subscription, at which point this message is sent to the new subscriber and from the PEP service which we have disabled anyway

But we wanted to be sure if this is the only use case and if it is safe to comment it off.

Please accept my gratitude for your comments in advance.

Thanks

Arun

dropped to about 256Mb from 1400MB

KB?

it seemed to us, that the lastmessage sent through a node is used only when creating a new subscription, at which point this message is sent to the new subscriber and from the PEP service which we have disabled anyway
AFAIK, the last message is always sent when the subscriber logs in.

MB.

1400 MB was the size of the heap dump after a big test of which 50% was occupied by the lastSendMessage objects and remaining by the input processing buffers of NIO/openfire. After changing this, a restest was done and the heap dumped which showed up to be 256Mb in size

AFAIK, the last message is always sent when the subscriber logs in.

ie Only for the 1st time login and not subsequently right? It looks like the messages are always send through and a reference is stored as the lastsendmessage.,
When a new subscription is created if any lastsendmessage is found, it seems to be send down.

Seems to me what you are saying is that, new subscriptions are satisfied, only when a user logs in?

Is that the only use case for the last message? Are there any hidden cases like re-sending upon failure etc, which might be affected if this simple caching is removed?

Thanks
Arun

These are the areas i could find the lastMessage being used in 3.8.2 code base -

I searched for references to LeafNode’s getLastPublishedItem call

  • nodeSubscription
    Comment from code - " If the subscription was pending of configuration then the last published item is going to be sent to the subscriber.

  • PEP Service (ignored since will be disabled anyway)

  • node.java

    • While creating new subscriptions - createSubscription function
    • Comment - // Send last published item (if node is leaf node and subscription status is ok)