[
https://jira.jboss.org/jira/browse/JBMESSAGING-180?page=com.atlassian.jir...
]
Attila Szegedi commented on JBMESSAGING-180:
--------------------------------------------
I don't have issues with starvation - it is really a problem if it causes a priority
inversion in the application, which, honestly, is an application level problem and
shouldn't be a concern of the messaging middleware. If the app suffers from priority
inversion problems, an anti-starvation solution will only "help" it insofar as
it'll allow the application to still run, but more slowly, instead of deadlocking
(which happens without anti-starvation). I might actually prefer a deadlock (I can detect
and analyze those nicely as all the participants are standing still) to a hard to diagnose
slowdown.
That said, a simple yet effective anti-starvation algorithm would be if you'd choose a
random integer between 0 and 9 every now and then (every second?), and then only deliver
messages with that priority or higher (as long as there's actual contention, of
course). This'll make sure priority 9 messages are always delivered, priority 5
messages are suppressed half the time, and priority 0 messages are suppressed 9/10th of
the time. (A different distribution can be achieved by nonlinear mapping of a wider random
number range to the priority range). The solution only needs a random number generator
local to the server-side processing component, and thus should scale nicely.
Anyway, just my 2c.
Design and implement a fairer message priority algorithm
--------------------------------------------------------
Key: JBMESSAGING-180
URL:
https://jira.jboss.org/jira/browse/JBMESSAGING-180
Project: JBoss Messaging
Issue Type: Task
Components: Messaging Core
Reporter: Tim Fox
Assignee: Tim Fox
Fix For: 2.0.0 Beta
JBoss Messaging queues can contain messages of different priorities from 0 (the lowest
priority) to 9 (the highest priority). When delivering messages to consumers JBoss
Messaging will attempt to deliver higher priority messages before lower priority
messages.
The current implementation simply delivers any higher priority messages before any lower
priority ones. This can result in starvation (i.e. they are never delivered) of lower
priority messages if higher priority messages continue to arrive.
The goal of this project is to design a fairer algorithm which still attempts to deliver
higher priority messages first but does not completely starve lower priority messages. The
algorithm also needs to be extremely efficient so as not to provide any significant
performance overhead on the message delivery process.
By definition a message priority algorithm cannot be completely "fair" but it
should certainly be "fairer" than it is now!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira