Prevent retrieving more MUC messages from DB than needed

Description

Openfire can be configured to retain message history for MUC rooms. Typically, the last 25 messages can be retrieved when joining a room (through the mechanism described in ), yet all messages are stored in the database.

When loading a room from the database, all historic messages are retrieved and ‘added’ to the in-memory history representation. When configuration calls for only 25 messages to be retained, this action needlessly loads all previous messages. This should be avoided.

The impact of this issue is more significant since , as this introduces a new cache that holds historic messages. That case is operated on under a lock (which is acquired per message that is added from the database). As that lock is cluster-wide, this adds a significant overhead. Open_chat (which holds approximately 250,000 messages) takes over half an hour to load in a cluster.

Environment

None

Activity

Show:
Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Created September 27, 2022 at 11:43 AM
Updated September 28, 2022 at 11:56 AM
Resolved September 28, 2022 at 11:56 AM