All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Limit the size of output buffers for Pub/Sub clients

Last Updated:Nov 14, 2024

Tair (Redis OSS-compatible) 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 (Redis OSS-compatible) closes the connection to the client. This prevents the buffered data from consuming excessive amounts of memory and ensures the performance of Tair (Redis OSS-compatible).

Limits on output buffers

Tair (Redis OSS-compatible) allocates an output buffer in the memory to each client. After Tair (Redis OSS-compatible) processes the requests from clients, it temporarily stores response data in output buffers and then sends the data to the clients. If you do not limit the data size in output buffers, large amounts 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 excessive amounts of memory.

Procedure

  1. Log on to the 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 the instance ID.

  2. In the left-side navigation pane, click Parameter Settings.

  3. In the parameter list, find the client-output-buffer-limit pubsub parameter and click Modify in the Actions column.

  4. In the dialog box that appears, set the hard limit, soft limit, and soft seconds values in sequence and separate them with spaces.

    Parameter options:

    • hard limit specifies a fixed limit in bytes. If the memory size used by the output buffer of a Pub/Sub client reaches or exceeds the hard limit value, Tair closes the connection to the client.

    • soft limit and soft seconds work together to define a soft boundary condition. If the output buffer of a Pub/Sub client reaches or exceeds the soft limit value (in bytes) for the soft seconds duration (in seconds), Tair closes the connection to the client.

    Note

    The default value of the hard limit option is 33554432 bytes (or 32 MB), the default value of the soft limit option is 8388608 bytes (or 8 MB), and the default value of the soft seconds option is 60 seconds.

  5. Click OK.

    After you set the options, you can view the settings in the console. You can also use redis-cli to connect to the instance and run the CONFIG GET client-output-buffer-limit command to view the settings.

Related API operations

API operation

Description

DescribeParameters

Queries the configuration and operational parameters of an instance.

ModifyInstanceConfig

Modifies the parameter settings of an instance.