Skip to main content
InterviewHubPRO
Section Overview
Q45

Question 45 of 50

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

90%
RabbitMQ & AMQP (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

Priority Queues (`x-max-priority`): How binary heap indexing works and why priority levels should be kept low.

senior LevelMost AskedMemory ManagementSystem DesignDatabases & SQL

In Simple Words: Priority queues allow urgent messages (e.g., password reset OTPs) to jump ahead of background bulk tasks (e.g., monthly newsletter emails):

  • Declared with "x-max-priority": 10.
  • Erlang Heap Overhead: Each priority level internally creates a separate sub-queue/binary heap within the Erlang process.
  • Best Practice: Never set x-max-priority > 10 (preferably 3 to 5). Setting priority to 255 consumes massive memory and severely degrades message ingestion rates.