All Products
Search
Document Center

:Query TPS charts

Last Updated:Sep 03, 2024

This topic describes how to query transactions per second (TPS) charts based on the message operation logs that are generated for an ApsaraMQ for RabbitMQ instance. If your ApsaraMQ for RabbitMQ instance is throttled due to exceeded TPS, you can query second-level TPS charts based on the methods described in this topic. This helps identify exceptions and ensure the availability of your business.

Prerequisites

You are logged on to the ApsaraMQ for RabbitMQ console. The message operation logs that are generated for an ApsaraMQ for RabbitMQ instance are pushed to Simple Log Service (SLS). For more information, see Configure message logs.

Background information

CloudMonitor provides charts that display the average of minute-level statistics for an ApsaraMQ for RabbitMQ instance. CloudMonitor does not provide second-level TPS data. The number of requests that clients initiate per second by calling Advanced Message Queuing Protocol (AMQP) methods is counted as the TPS of an ApsaraMQ for RabbitMQ instance.

The following items describe the AMQP methods that are involved in TPS counting:

  • ConnectionOpen and ChannelOpen

  • QueueDeclare, QueueDelete, QueueBind, and QueueUnbind

  • ExchangeDeclare and ExchangeDelete

  • ExchangeBind and ExchangeUnBind

  • SendMessage, BasicConsume, BasicGet, BasicAck, BasicReject, BasicNack, and BasicRecover

For more information, see Request method.

Procedure

Specify a time range to query, configure the chart properties, and then enter an SLS query statement in the search box to query a TPS chart. For more information, see Query and analyze logs.

* | select microtime/1000/1000 as time, sum(count) as tps from (SELECT  microtime, if(Action!='SendMessage', 1, if(ReceiptHandle='', 1, cast(ReceiptHandle as bigint))) as count from log Where  CommodityInstanceId='amqp-xx-xxx' and Action in ('SendMessage', 'ConnectionOpen', 'ChannelOpen', 'ExchangeDeclare', 'QueueBind', 'QueueDeclare', 'QueueDelete', 'ExchangeDelete', 'QueueUnBind', 'ExchangeBind', 'ExchangeUnBind', 'BasicConsume', 'BasicReject', 'BasicRecover', 'BasicAck', 'BasicNAck', 'PullMessage') limit 90000000) GROUP by time ORDER by time limit 90000000
Note
  • Replace amqp-xx-xxx in the preceding code with the ID of the instance whose TPS chart you want to query.

  • If the client calls BasicNack with the multiple=false setting, a request is sent for each call. If the client calls BasicNack with the multiple=true setting, multiple requests are sent for each call. However, SLS creates only a log entry for a BasicNack call, regardless of whether multiple requests are sent for a call. Therefore, the TPS returned in a TPS chart is smaller than the actual TPS.

  • When you query a TPS chart, if a large amount of traffic is received by your client, we recommend that you specify a time range that is less than or equal to 1 hour and add limit 90000000 to the SQL statement that is executed to query the TPS chart. You can also replace 90000000 in limit with the largest possible value.