how and in what order JMS dispatch messages to MDBs


EJB programming & troubleshooting: how and in what order JMS dispatch messages to MDBs

  1. how and in what order JMS dispatch messages to MDBs (1 messages)

    Hi Java Gurus/Users,
    [SeetUp = OS; Win200 JBOSS : 2.2.2 JDK: 1.3]
    I have setup of two MDBs listening to two topics having pool configuration MDB1= 5, MDB2=10.
    I am sending same messages through multithreaded client to these topics. I am trying to measure performance of MDB to carry out certain business calculations (these two MDBs call same session bean for business calculations).
    But every time I run test I get different results. Sometimes MDB1 performs better than MDB2 even though pool size of MDB2 is larger. Ideally MDB2 should perform two times better than MDB1 due to pool size. I am not very clear about how JMS dispatches/allocates messages to these MDBs. I think JbossMQ is not forwarding messages in the order client sent. Is it a bug in Jboss?
    can ne one give some input about JMS working about arrival and dispatch of messages to MDBs.
  2. As for the performance differences, a larger pool does not neccesarily yield better performance. It depends on how your VM handles threads, how much data the threads roll around (how many context switches), how much CPU you have, etc.
    As an anecdote, when there is no IO involved (which is never the case) single-threaded engines are usually faster.
    The reason you should increase the size of the pool is to improve the service time of a single client request when there is a large load of requests. Not to increase performance in general.

    As for the ordering of messages in JMS, this is not a bug. There is allmost no guarantee about the order at which messages are handed to JMS listeners (including message beans). You shouldn't assume anything about the order in your JMA listeners (this is one of the main challanges when using MOM).