May 6th, 2011, 02:31 AM
MessageGroupStoreReaper + JdbcMessageStore = n + 1 select problem
I have a large number of messages in an aggregator which will not be correlated. Using a reaper to expire the messages utilizes the AbstractMessageGroupStore iterator abstraction to loop through the message groups and evaluate their age.
While an elegant Java solution for the memory implementation, when implemented by the JdbcMessageStore, the respective iterator abstraction will result in n (LIST_MESSAGES_BY_GROUP_KEY query) + 1 (LIST_GROUP_KEYS query) select statements in the database. This poses no issue for a few messages, however it is not practical for thousands of messages. The DB server promptly chokes.