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.
The TPS counts the AMQP requests of the following types:
For more information about the request methods, see Request method.
- 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.
- 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 90000000Note
- 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
limit 90000000to the SQL statement that is executed to query the TPS chart. You can also replace 90000000 in limit with the largest possible value.