Tair provides the client-output-buffer-limit pubsub parameter for you to specify a size limit for output buffers of Pub/Sub clients. If the data to be buffered for a Pub/Sub client exceeds the size limit, Tair closes the connection to the client. This prevents the buffered data from consuming too much memory and ensures the performance of Tair.

Limits on output buffers in Tair

Tair allocates an output buffer in the memory to each client. After Tair processes the commands from clients, it temporarily stores command output data in output buffers and then sends the data to the clients. If you do not limit the data size in output buffers, a large amount of data may accumulate in output buffers. The data may eventually use up all the available memory and result in a service failure. This issue may occur in the following scenarios:

  • Large amounts of data need to be returned for commands from clients.
  • Message publishing outpaces message consumption.

You can set the client-output-buffer-limit pubsub parameter to a proper value to prevent the output buffers of Pub/Sub clients from consuming too much memory.

Options

The client-output-buffer-limit pubsub parameter includes the following options: hard limit, soft limit, and soft seconds.

  • hard limit specifies a fixed limit. Unit: bytes. If the output buffer of a Pub/Sub client reaches or exceeds the hard limit value, the client is immediately disconnected.
  • soft limit specifies a limit that depends on the time. Unit: bytes. soft seconds specifies the amount of time for which to continuously trigger a soft limit. Unit: seconds. If the output buffer of a Pub/Sub client reaches or exceeds the soft limit value for a period of time in seconds that is specified by the soft seconds parameter, the client is disconnected.

In Tair, the default value of the hard limit parameter is 33554432 bytes (or 32 MB), the default value of the soft limit parameter is 8388608 bytes (or 8 MB), and the default value of the soft seconds parameter is 60 seconds. You can customize the values based on your business requirements and client capacities.

Procedure

  1. Log on to the Tair console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click its ID.
  2. In the left-side navigation pane, click System Parameters.
  3. On the page that appears, find the client-output-buffer-limit pubsub parameter and click Modify in the Actions column.
  4. In the dialog box that appears, perform the following steps:
    1. Specify the client-output-buffer-limit pubsub parameter based on the description in the Options section of this topic.
    2. Click OK.
    Note After you complete these settings, you can view them in the Tair console. You can also use redis-cli to connect to the Tair instance and run the CONFIG GET client-output-buffer-limit command to view the settings. For more information about redis-cli, see Use redis-cli to connect to a Tair instance.

Related API operations

Operation Description
DescribeParameters Queries the configuration and operational parameters of a Tair instance.
ModifyInstanceConfig Modifies parameters of a Tair instance.