ApsaraDB for Redis 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, ApsaraDB for Redis closes the connection to the client. This prevents the buffered data from consuming too much memory and ensures the performance of ApsaraDB for Redis.
Limits on output buffers in ApsaraDB for Redis
ApsaraDB for Redis allocates an output buffer in the memory to each client. After processing the commands from clients, ApsaraDB for Redis temporarily stores the result data in output buffers and then sends the result data to the clients. If you do not limit the size of data 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 crash. This issue may occur in the following scenarios:
- A large amount of data needs to be returned for commands from clients.
- Message publishing outpaces message consumption.
By setting the client-output-buffer-limit pubsub parameter to a proper value, you can prevent the output buffers of Pub/Sub clients from consuming too much memory.
The client-output-buffer-limit pubsub parameter includes the following options:
soft limit, and
hard limit: If the output buffer of a Pub/Sub client reaches or exceeds the number of bytes specified by
hard limit, the client is immediately disconnected.
soft seconds: If the output buffer of a Pub/Sub client reaches or exceeds the upper limit specified by
soft limitfor a period of time in seconds that is specified by
soft seconds, the client is disconnected.
In ApsaraDB for Redis, the default values of
soft limit, and
soft seconds are 33554432 bytes (32 MB), 8388608 bytes (8 MB), and 60 seconds, respectively. You
can customize the values based on your business requirements and the capacities of
Specify the parameter in the ApsaraDB for Redis console
- Log on to the ApsaraDB for Redis console.
- In the upper-left corner of the page, select the region where the instance is deployed.
- On the Instances page, find the target instance, click the instance ID or click Manage in the Actions column.
- On the Instance Information page, click System Parameters in the left-side navigation pane.
- On the page that appears, find the client-output-buffer-limit pubsub parameter and click Modify in the Actions column.
- In the dialog box that appears, follow these steps to specify the parameter.
- Specify the client-output-buffer-limit pubsub parameter based on the description in Parameter options.
- Click OK.
Call API operations to set parameters
You can also call the ModifyInstanceConfig operation to set parameters.