Confirmed users
192
edits
No edit summary |
No edit summary |
||
| Line 24: | Line 24: | ||
* Ben Bangert | * Ben Bangert | ||
* Hanno Schlichting | * Hanno Schlichting | ||
= Architecture = | = Architecture = | ||
| Line 148: | Line 98: | ||
queues in a job processing setup. The Qdo library utilizes Apache Zookeeper for | queues in a job processing setup. The Qdo library utilizes Apache Zookeeper for | ||
worker and queue coordination. | worker and queue coordination. | ||
Workers coordinate to divide up the queue's and partitions in each queue so | |||
that no queue/partition has multiple readers. This avoids the need for read | |||
locking a queue, and how far into each host+queue+partition is stored in | |||
Zookeeper. | |||
This model is based exactly on how Apache Kafka workers divide up queues to | |||
work on. | |||
== Example Deployment Configurations == | == Example Deployment Configurations == | ||
| Line 369: | Line 327: | ||
setup for the various consumers. | setup for the various consumers. | ||
* Consumers will process crashes off the queues | * Consumers will process crashes off the queues | ||
= Design Background = | |||
An initial search was done of available message queue products to determine if | |||
any of them would be appropriate for Sagrada. Generally, most MQ's do not | |||
assume message persistence is of great importance, don't have a good RESTful | |||
API, and/or aren't built with the assumption that millions of queues will be | |||
used at once. Having a configurable MQ that can easily have the various message | |||
delivery guarantee's and availability options toggled is quite important, so | |||
Queuey is unique in that deployment and configuration drastically alter the | |||
actual MQ one works with. | |||
For scalability purposes, since some messages may be retained for periods of | |||
time per Notifications requirements and millions of queues will be required, | |||
the initial choice for the backend is Cassandra. As Cassandra also provides | |||
fast reads with internal caching (like memcached), using it in single node mode | |||
for Socorro should also work well. | |||
When used for Notifications, each user will have a single queue per Notification | |||
Application, this helps ensure that even for an individual user receiving many | |||
messages, they are partitioned by the Notification Application to ensure | |||
a more level distribution rather than a single deep queue. | |||
Under the Socorro use-case, it is most likely desired that massive amounts of | |||
messages may be intended for the same queue, which would normally result in a | |||
single extremely deep queue. Deep queue's do not scale well horizontally, | |||
especially when using Cassandra which maximizes through-put across many | |||
row-keys. | |||
The other issue is that to consume messages, there are only two effective ways | |||
of marking a message as consumed: | |||
1. The message may be deleted after it has been sent. The only problem in | |||
this case is that there is still no guarantee it has been processed, and | |||
acquiring a lock to consume a message, and the resulting write-back to | |||
delete it is expensive. | |||
2. One consumer per queue/partition. This requires some guess-work up-front | |||
about how many consumers will be around. Since consumers can consume from | |||
multiple queue/partition's at once, there needs to be at least as many | |||
partitions for a queue, as desired consumers. The advantage with this | |||
approach is that locking is only necessary when adding/removing consumers | |||
to ensure one consumer per partition. | |||
Queuey goes with the second option, and only incurs the lock during consumer | |||
addition/removal. The MessageQueue also does not track | |||
the state or last message read in the queue/partition's, it is the consumers | |||
responsibility to track how far it has read and processed successfully. There | |||
is an API call available to record with the MessageQueue how far a consumer | |||
has successfully processed in a queue/partition. | |||