Overview
The consumer consumes messages slowly.
Possible Causes
High server load
Traffic throttling issue
Client load
Consumer processing capacity issue
Network issue
Solutions
High server load
To confirm whether the cause is a server issue, you can view the consumption time in Advanced Monitoring in the console. The time information indicates the time taken by the server to process requests. If there is an issue with the server load, you can observe higher time statistics at each processing stage, as shown in the figure below:
Traffic throttling issue
To confirm whether the cause is a traffic throttling issue, you can configure a bandwidth over-limit alarm. Choose Monitoring > Instance to check whether the peak bandwidth of the instance has been reached. If the peak bandwidth has been reached, you need to upgrade the instance's peak bandwidth. For how to upgrade instance configurations, see Changing Instance Specifications. Client load
If there is no performance issue with the server, the cause is probably the insufficient consumption capacity of the client. First, check the mapping between partitions and consumers. If a single consumer is consuming too many partitions, it is recommended to increase the number of consumers. Try to make one consumer consume only one partition. View the partition-to-consumer mapping, as shown in the figure below:
Consumer processing capacity issue
If the partition-to-consumer assignment is normal, you can scale out partitions in the console to increase data consumption parallelism. Partition scale-out in the console is instantaneous and lossless, with no impact on your business. Scale out partitions as shown in the figure below:
Network issue
Check the client load. For example, check metrics such as the CPU, memory, and network interface card (NIC) on the client machine. For a Java process, focus on the usage of GC and heap memory.
Consumption linkage issue
Check the downstream segment of the message consumption linkage for other causes for the slow consumption speed. For example, consuming messages requires certain synchronous operations to be completed before submitting the offset to the server. Common abnormal downstream operations include:
Logs are printed frequently.
Database writes are slow.
The business logic is complex, causing slow message processing.
If the issue cannot be resolved quickly, it is recommended to increase the number of topic partitions and scale out consumer instances to rapidly boost the message consumption speed.