• Distributed Message Service

dms
  1. Help Center
  2. Distributed Message Service
  3. User Guide
  4. FAQs
  5. Why Can't I Retrieve the Chosen Number of Messages from the Queue That Contains Only a Few Messages?

Why Can't I Retrieve the Chosen Number of Messages from the Queue That Contains Only a Few Messages?

  • FIFO queues

    Messages in the same queue are stored in a single partition. Therefore, each retrieval request can return the chosen number of messages unless the available number of messages in the queue is less than the chosen number of messages.

  • Other types of queues

    Messages in the same queue are distributed to multiple partitions. This achieves higher concurrency, allowing multiple requests from a consumer group to be processed at the same time. To avoid performance loss caused by cross-partition access and management, a single retrieval request from a consumer group returns messages in only one partition. Therefore, when a queue holds a small number of available messages, a single retrieval request may not return the chosen number of messages even if the number of available messages in the queue is greater than the chosen number of messages.

    For example, as shown in Figure 1, 12 messages exist in the queue and are distributed into three partitions.
    Figure 1 A single retrieval request retrieves messages from only one partition

    If the chosen number of messages is 10, only four messages can be retrieved from Partition 0. After retrieval from Partition 0 is complete, messages are retrieved in sequence from Partition 1 and Partition 2.