This topic describes how to query transactions per second (TPS) charts based on the message logs that are generated for a Message Queue for RabbitMQ instance. If the maximum number of requests that you can send per second without being throttled is exceeded, you can query second-level TPS charts based on the methods described in this topic. This can help you identify exceptions and ensure availability of your business.

Prerequisites

You are logged on to the Message Queue for RabbitMQ console. The message logs that are generated for a Message Queue for RabbitMQ instance are pushed to Log Service. For more information, see Configure message logging settings.

Background information

CloudMonitor provides charts that display the average of minute-level statistics for a Message Queue for RabbitMQ instance. CloudMonitor does not provide second-level TPS data. The TPS of a Message Queue for RabbitMQ instance counts the number of Advanced Message Queuing Protocol (AMQP) requests sent by clients per second.

The TPS counts the AMQP requests of the following types:

  • ConnectionOpen
  • ChannelOpen
  • QueueDeclare
  • QueueDelete
  • ExchangeDeclare
  • ExchangeDelete
  • QueueBind
  • QueueUnbind
  • ExchangeBind
  • ExchangeUnBind
  • SendMessage
  • BasicConsume
  • BasicGet
  • BasicAck
  • BasicReject
  • BasicNack
  • BasicRecover

For more information about the request methods, see Request method.

Procedure

  1. Log on to the Log Service console and configure indexes for log fields.
    For more information, see Configure indexes. You must configure indexes for the common fields that are automatically generated by the system. You must also add the __tag__:__receive_time__ field, set its alias to timestamp, and then configure an index for the field, as shown in the following figure. Configure Index
  2. Specify a time range to query, configure the chart properties, and then enter an analytic statement in the search box of Log Service to query a TPS chart. For more information, see Query logs.
    (Action : ConnectionOpen or Action : ChannelOpen or Action: ExchangeDeclare or Action: QueueBind or Action : QueueDeclare or Action : QueueDelete or Action : ExchangeDelete or Action : QueueUnBind or Action : ExchangeBind or Action : ExchangeUnBind or Action : BasicConsume or Action : BasicReject or Action : BasicRecover or Action : SendMessage or Action : BasicAck or Action : BasicNack or Action : BasicGet ) | select from_unixtime (cast(timestamp AS double)) as time, COUNT(*) as count GROUP by time ORDER by time limit 90000000     
    Query a message trace
    Note
    • 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, Log Service 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.