Is it a good practice to use JMS Temporary Queue for synchronous use?

后端 未结 7 877
有刺的猬
有刺的猬 2021-01-30 18:20

If we use JMS request/reply mechanism using \"Temporary Queue\", will that code be scalable?

As of now, we don\'t know if we will supporting 100 requests per second, or

7条回答
  •  温柔的废话
    2021-01-30 18:34

    Interestingly, the scalability of this may actually be the opposite of what the other responses have described.

    WebSphere MQ saves and reuses dynamic queue objects where possible. So, although use of a dynamic queue is not free, it does scale well because as queues are freed up, all that WMQ needs to do is pass the handle to the next thread that requests a new queue instance. In a busy QMgr, the number of dynamic queues will remain relatively static while the handles get passed from thread to thread. Strictly speaking it isn't quite as fast as reusing a single queue, but it isn't bad.

    On the other hand, even though indexing on CORRELID is fast, performance is inverse to the number of messages in the index. It also makes a difference if the queue depth begins to build. When the app goes a GET with WAIT on an empty queue there is no delay. But on a deep queue, the QMgr has to search the index of existing messages to determine that the reply message isn't among them. In your example, that's the difference between searching an empty index versus a large index 1,000s of times per second.

    The result is that 1000 dynamic queues with one message each may actually be faster than a single queue with 1000 threads getting by CORRELID, depending on the characteristics of the app and of the load. I would recommend testing this at scale before committing to a particular design.

提交回复
热议问题