in my python app I'm using Celery as task producer and consumer and RabbitMQ as a broker. Now, I'm implementing prioritization. At first, it looks like it's not working at all, because, according to documentation, I've just added x-max-priority
argument to queues. I looked up deeper, and I've found another prioritizations - consumer prioritization and task prioritizations. So, now, it looks like there are three different prioritizations and I'm totally confused. Could you please explain me the difference?
Queue max priority: viz https://www.rabbitmq.com/priority.html
Queue('my_queue', exchange=Exchange('my_queue'), routing_key='my_queue', queue_arguments={'maxPriority': 10})
Consumer priority: viz https://www.rabbitmq.com/consumer-priority.html
Queue('my_queue', exchange=Exchange('my_queue'), routing_key='my_queue', consumer_arguments={'priority': 10})
Task priority: viz https://github.com/celery/celery/issues/2635#issuecomment-173597053
my_task.apply_async(args=(arg1, arg2), priority=6)
Thank you.
Edited after more study:
As I understood after more reading:
Queue max priority is a type of limitation, and tells that this queue is listening only tasks with the priority set to value max up to this argument. But what about higher priority tasks? Does the queue lower priority to itself maximum defined? Ignores them?
Consumer priority looks like prioritization of consumers. If there are two consumers with different priority and both of them are free, the first one who consumes the messages is the one with higher priority. But why is it defined with the Queue and not with the consumer itself?
Task priority should be the prioritization, which is most important to my needs. It tells that this message should be read with given priority.
So, it looks like the best prioritization will be achieved with the combination of all priorities with multiple workers and concurrency set to 1, rather than one worker with higher concurrency and with the worker_prefetch_multiplier
and task_acks_late
configured.
What do you think? Is that right?