Currently we use Global queue to handle the scenario where we receive messages for a queue that does not have any subscriptions. However, due to this large latency is added and message need to copied around lot.
Shammi and myself were discussing and look like it is possible to remove it completely. Following is the proposal. 1. We define a concept called slots where we can store messages in Cassandra. Each slot map to a row in Cassandra or a RDBMS table. There are queuesCount X nodeCount slots in the system. 2. Only one node own a slot at a time. When the node own the slot, it reads messages from the slot and send to subscribers. (This is what QueueDeliveryWorker do). This slot assignment we can manage via hazecast. 3. When we receive messages, if there is no subscription, we take a slot and write messages to that slot. When there is subscription to that queue, we assign the slot to associated node for subscription. 4. If a queue has subscriptions from multiple nodes, then we will give it several slots, assign those slots to corresponding nodes.The we distribute messages to those slots. 5. With this model, each message will be only written once and read once mostly. 6. There will be some edge cases (e.g. when a node run out subscriptions etc) where we might need to merge or split messages in slots. These we have to do carefully, but since those are rare, the overhead added is minimal. 7. Each query delivery worker would need to read a slot for each queue. So we need to keep a thread pool and manage reading. This should also reduce number of Cassandra calls by about 50%. WDYT? --Srinath -- ============================ Srinath Perera, Ph.D. http://people.apache.org/~hemapani/ http://srinathsview.blogspot.com/
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
