Initial load of MUCRoom service properties is inefficient

Description

https://github.com/igniterealtime/Openfire/pull/1394

 

Hi, I tested Openfire 4.2.3 with 200,000 MUC rooms. And I found out loading MUC rooms can be very slow in proportion to the number of rooms. In my case, it needed over 1 hour to start Openfire.
I identified the cause in MUCPersistenceManager. (This problem still exists in Openfire 4.3 or later)

  • After fetching MUC rooms from {{ofmucroom}} table, each {{LocalMUCRoom}} loads its default properties from {{ofmucserviceprop}} table with MUCPersistenceManager. This process calls {{SELECT}} SQL about 200,000 * 12 times (the 12 is the number of LocalMUCRoom.xxx fields). In the end, the more MUC rooms the more time needed.

I tweaked MUCPersistenceManager.getProperty just a little bit.

Environment

None
Fixed

Assignee

Dave Cridland

Reporter

Daryl Herzmann