Database Queues and Queue Processing

I am currently in the process of putting together a reference architecture for a distributed event-based system where events are stored in a SQL Server Azure database using plain old tables (no SQL Server Service Broker).

Events will be processed using Worker Roles that will poll the queue for new event messages.

In my research, I see a number of solutions that allow for multiple processors to process messages off of the queue. The problem I have with a lot of the patterns I'm seeing is the added complexity of managing locking, etc when multiple processes are trying to access the single message queue.

I understand that the traditional queue pattern is to have multiple processors pulling from a single queue. However, assuming that event messages can be processed in any order, is there any reason not to just create a one-to-one relationship between a queue and its queue processor and just load-balance between the different queues?

queue_1 => processor_1
queue_2 => processor_2

Эта реализация позволяет избежать всех подключений, необходимых для управления одновременным доступом к очереди через несколько процессоров. Издатель событий может использовать любой алгоритм балансировки нагрузки, чтобы решить, в какую очередь публиковать сообщения.

Тот факт, что я не вижу такой реализации ни в одном из моих поисков, заставляет меня думать, что я не замечаю серьезного недостатка в этот дизайн.

Изменить

Эта публикация вызвала дебаты по поводу использования таблиц базы данных в качестве очередей по сравнению с MSMQ, очередями Azure и т. д. Я понимаю, что мне доступны некоторые собственные варианты организации очередей, включая устойчивые буферы сообщений в Azure AppFabric. Я оценил свои варианты и решил, что таблиц SQL Azure будет достаточно. Цель моего вопроса состояла в том, чтобы обсудить использование нескольких процессоров против одной очереди vs. один процессор на очередь.

5
задан David Makogon 31 January 2012 в 03:30
поделиться