简体   繁体   English

贪婪的线程在WebLogic下捕获了太多的JMS消息

[英]Greedy threads are grabbing too many JMS messages under WebLogic

We encountered a problem under WebLogic 8.1 that we lived with but could never fix. 我们在WebLogic 8.1中遇到了一个问题,但无法解决。 We often queue up a hundred or more JMS messages, each of which represents a unit of work. 我们经常将一百或更多的JMS消息排队,每条消息代表一个工作单元。 Despite the fact that each message is of the same size and looks the same, one may take only seconds to complete while the next one represents 20 minutes of solid crunching. 尽管每封邮件的大小相同且看起来相同,但一封邮件可能只需要几秒钟即可完成,而下一封邮件则需要20分钟的处理时间。

Our problem is that each of the message driven beans we have doing the work of these messages ends up on a thread that seems to grab ten messages at a time (we think it is being done as a WebLogic optimization to keep from having to hit the queue over and over again for small messages). 我们的问题是,我们正在处理这些消息的每个消息驱动bean最终都在一个线程中,该线程似乎一次捕获10条消息(我们认为这是作为WebLogic优化来完成的,从而避免了必须一遍又一遍地排队等候小消息)。 Then, as one thread after another finishes all of its small jobs and no new ones come in, we end up with a single thread log jammed on a long running piece of work with up to nine other items sitting waiting on it to finish, despite the fact that other threads are free and could start on those units of work. 然后,当一个线程接一个线程完成所有小任务而又没有新任务进入时,我们最终将单线程日志卡在了一个长期运行的工作上,尽管有多达九个其他项目等待完成其他线程是免费的,并且可以在这些工作单元上开始。

Now we are at a point where we are converting to WebLogic 10 so it is a natural point to return to this problem and find out if there is any solution that we could implement so that either: a) each thread only grabs one JMS message at a time to process and leaves all the others waiting in the incoming queue, or b) it would automatically redistribute waiting messages (even ones already assigned to a particular thread) out to free threads. 现在我们到了要转换到WebLogic 10的地步,因此很自然地回到这个问题,并找出是否可以实现任何解决方案,以便:a)每个线程仅在以下位置捕获一条JMS消息:一个时间来处理并将所有其他消息留在传入队列中,或者b)它会自动将等待消息(甚至是已分配给特定线程的消息)重新分配给空闲线程。 Any ideas? 有任何想法吗?

Enable the Forward Delay and provide an appropriate value. 启用转发延迟并提供适当的值。 This will cause the JMS Queue to redistribute messages to it's peers if they have not been processed in the configured time. 如果未在配置的时间内处理消息,这将导致JMS队列将消息重新分发给它的对等方。

Taking a single message off the queue every time might be overkill - It's all a balance on the number of messages you are processing and what you gauge as an issue. 每次仅将一条消息从队列中移出可能是过大的-在处理的消息数和要衡量的问题上,这都是一个平衡。

There are also multiple issues with JMS on WebLogic 10 depending on your setup. WebLogic 10上的JMS还会存在多个问题,具体取决于您的设置。 You can save yourself a lot of time and trouble by using the latest MP right from the start. 从一开始就使用最新的MP,您可以节省很多时间和麻烦。

当线程在获取资源后可以执行“饥饿”操作时,处于饥饿状态的线程称为“贪婪线程”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM