10-27-2006 01:54 PM
10-27-2006 01:59 PM
10-27-2006 02:12 PM
10-27-2006 02:38 PM
10-27-2006 02:48 PM
10-27-2006 02:57 PM
It actually sounds like a fairly dicey problem, depending on your need for response times and total messaging bandwidth. Many of the issues seem to revolve around multiple producers and consumers wanting simultaneous read and write access to a continuously changing entity. At least that's how it sounded to me, that all the consumers are independent and should be allowed to consume their own messages just as soon as they're able to notice them.
For example:
Consumer #3 performs a preview and discovers that there's a message waiting at position #9. In order to pull it out of the queue, it must first dequeue the first 8 messages in line. Then after dequeueing its own message, it must re-enqueue those 1st 8 messages, this time using "Enqueue at Opposite End" to restore the original sequence.
However, before it can finish re-enqueue'ing those 8, Consumer #11 performs a preview and discovers that there's a message at (apparent) position 4. This really *should* be position 12, but how can Consumer #11 know what #3 is in the middle of?
Meanwhile, one of Consumer #3's 8 messages is addressed to Consumer #11, and it's actually quite important that Consumer #11 gets this one first instead of the one that it just found for itself
And so on...
Now, some (most? all?) of this kind of conflict can be resolved through the use of semaphores, but the penalty is that whenever any Consumer is accessing the shared queue, 100's of other Consumers are stuck waiting their turn. And so all the independence and parallelism you were after in the first place with the producer / consumer pattern starts slipping away...
I haven't personally built an app around a massively parallel messaging architecture. I hope someone who has gets involved here because I'd like to learn how it's done. I'd wager there are a few different elegant solutions, but all I can manage to think of are the pitfalls.
-Kevin P.
10-27-2006 03:17 PM
10-27-2006 03:39 PM
10-27-2006 04:00 PM
10-27-2006 04:06 PM