Monday, July 06, 2009

Boosting Concurrency and Throughput Of The Message-Driven Beans

Message-Drive Bean Pool
Message-driven bean can concurrently process JMS messages using pool of multiple instances. MDB pool size can be configured using "initial-beans-in-free-pool" and "max-beans-in-free-pool" elements of the deployment descriptors. If all instances of an MDB are active and max-beans-in-free-pool has been reached, JMS “onMessage()” requests will be blocked until an active MDB completes a method call. MDB pool size configuration with high number of instances alone is not sufficient to insure higher concurrency in all cases. Actual concurrency of message driven bean's JMS processing depends on number of threads available or allocated to message driven bean.

Thread Constraint
With WebLogic auto tune thread pool default limit of the available maximum threads to execute "onMessage()" of the message driven bean is 16. It means that even with Message driven bean's pool size of > 16, It can not process more than 16 messages concurrently. WebLogic work manager with "max-thread-constraint" will allows to allocate higher number of threads to message driven bean.

Transaction Batching
It is also possible to achieve higher throughput by packing multiple message in single transaction (max-messages-in-transaction). Message batching reduces number of transactions needed to process a given number of messages.

Server Affinity In Cluster
By default "server affinity" is configured for clustered connection factory to reduce network overhead. With this default setting message produced on distributed destination are pushed to local physical JMS destination. Turning off the "server affinity" allows producer to produce messages equally across multiple physical destinations. Physical distribution of the messages in cluster improves downstream (message-driven bean’s) concurrency in cluster.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home