redis client buffer

The output (i.e. the return value of the command) the Redis server, its size is typically uncontrollable. Possible a simple command can be generated bulky return data. There is also probably because too many command execution, resulting in a rate of return data to generate more than the rate sent by the client, the server can lead to the accumulation of which is the large number of messages, causing the output buffer increases, take up too much memory, and even lead to a system crash.

Fortunately, Redis set some protection mechanisms to avoid this situation, the different types of clients have different restrictions parameters. There are two restrictions ways:

(1), the size limit, when a client buffer exceeds a certain size value, directly off the connection to the client;

(2) for restriction, when a client of a buffer for a time occupied too much space, is connected directly to close the client.

 

Let's look at the configuration file to configure the client on the output buffer:

client-output-buffer-limit normal 0 0 0

client-output-buffer-limit slave 256mb 64mb 60

client-output-buffer-limit pubsub 8mb 2mb 60

 

Different clients have different strategies, policies are as follows:

Ø For ordinary clients, the limit is zero, which is not limited. Because the normal client usually blocking message answer mode, what is blocking it? Such as: send a request, waiting to return, retransmission request, and then wait for a return. In this mode, the server generally does not result in the output stacking Redis expansion buffer;

Ø For Pub / Sub client (ie publish / subscribe model), the size limit is 8M, when the output buffer is more than 8M, will close the connection. Continuing restriction is when the client buffer size exceeds 60 seconds 2M, client connection is closed;

For Ø slave clients, the size limit is 256M, persistent restriction when a client buffer size of 60 seconds more than 64M, the client connection is closed.

Guess you like

Origin www.cnblogs.com/tomcuper/p/11534202.html