The MessagStore and AcknowledgmentStore implementations delegate the persistence work to a PersistenceManager, which could be subject of various optimizations. The initial version of the PersistenceManager will be based on JBoss MQ's. When designing/implementing, the following aspects should be considered.
1) Make use of the datasource mappings - similar what has been done for the EJB timer
2) The use of the JTA transaction in JDBC2 is unnecessary since we are the only one in the transaction branch. A local JDBC transaction i.e. setAutoCommit(false) is enough. The transaction still needs suspending so we are isolated from any wrapping transacton.
3) Make use of bulk writes to the database. This can be used for transactional sessions where multiple messages are processed. But it could also be used where people want to relax the absolute requirement that messages are persisted in return for some performance improvement.
4) Lazily write the transaction record - it is only necessary when there are actually persistent messages in the transaction.
5) Improve the sql - db indexes, etc.
6) JDBC3 is an attempt to reduce the cloning of messages for topics this could be taken further with a more dedicated message store.
7) Lazy loading queues: Messages will only be loaded into the server when the destination is activated and then only part of the messages are loaded (enough to deal with the current throughput). An attempt was made to do this and committed on Branch JBoss_3_2_5_JBossMQ_Lazy but the work was abandoned (http://jboss.org/index.html?module=bb&op=viewtopic&t=46186). It does not deal with the more difficult problems. In any case, the BasicQueues should be talking directly with the PersistenceManager. In fact, I would favour that the BasicQueue implementation is actually pluggable and determined by the PM to allow better optimization between these two important layers.
8) A general review of where the persistence manager is invoked from the server with an aim to improve performance.
The corresponding JIRA task: http://jira.jboss.com/jira/browse/JBMESSAGING-18