Redis configuration Detailed-Client buffer output buffer

Source: Internet
Author: User

Redis configuration Detailed-client buffer http://blog.csdn.net/jiangguilong2000/article/details/38436941


Redis Exceptions and Usage summary http://blog.csdn.net/jiangguilong2000/article/details/45025355



Client buffer Output Buffer

Redis, like its name and design, is a mobile server, and the client (usually) connects to Redis over the network. In this case, the time that the client requests to return the client will be significantly longer than the Redis CPU reads the data from RAM. This means that if there is no client buffer, the major differences between Redis are related to the response to the service during that time. The
client buffers make up the memory space required for service client requests, and each Redis connection has its own buffer space. After processing the request, Redis copies the response data to the client buffer and then continues processing the next request, while the requesting client reads the data over the network connection. Redis client buffers are configured in the redis.conf file:

    1. Config get Client-output-buffer-limit

    2. 1) "Client-output-buffer-limit"

    3. 2) "Normal 0 0 0 slave 268435456 67108864 pubsub 33554432 8388608" </span>

Output buffer is a buffer allocated by Redis to the client (the "client" may be a real client or a slave or monitor), and if the output buffer assigned to a client exceeds the reserved size, Redis may turn off connections to that end based on the configuration policy.
For example, if Redis is used as a message queue, the corresponding output buffer overrun occurs when the consumer processing speed of the ordering message does not match the producer of the published message.
The configuration entry format is as follows:
Client-output-buffer-limit <class> &LT;CLASS&GT: currently supports 3 types of clients:
1) normal = normal clients;
2) Slave clients and MONITOR clients;
3) PubSub = clients subcribed to at least one pubsub channel or pattern
<soft limit> <soft seconds&gt: If the output buffer size exceeds soft limit and the duration of this condition exceeds soft seconds, Redis closes the connection to the corresponding client.
The default configuration is as follows:
Client-output-buffer-limit Normal 0 0 0
Client-output-buffer-limit slave 256MB 64MB 60
Client-output-buffer-limit pubsub 32MB 8MB 60
These values represent the buffer soft limit, the hard limit, and the timeout in seconds (similar to the copy buffer). When Redis terminates the connection, these values provide protection--no need for the customer to read the reply--when the buffer size reaches a soft limit and hold the state until timeout b) hard limit. Setting these values to 0 means that protection is off.
However, unlike the copy buffer, the client buffer is from the Redis data memory space. Redis's total memory value can be set through the maxmemory instruction, and Redis will apply its configured eviction policy (defined by the Maxmemory-policy Directive) when the limit is reached. Therefore, a low-performance customer or a large number of simultaneous connections may cause the Redis instance to prematurely eject keys or disallow updates because the dataset size and client buffers reach memory limits.

Due to the relativity of the life cycle, a client does not need to degrade performance to be able to cause this phenomenon. Because there is a significant speed difference between RAM reads and network reads, excessive client buffers are likely to run out of redis memory, even in high-performance clients and network connections. For example, consider the (evil) keys command, which, after this instruction is triggered, will copy the entire name space of the key to the client buffer. If our database has a lot of keys, this is likely to lead to eviction.


Redis Master-Slave configuration

Primarily for single-point, global redis for master-slave configuration and incremental update request data with AoF method

At the end of the master Redis configuration, Redis.conf adds

Include/data/redis/6379/instance.conf

And then the content in the instance.conf of the lateral

AppendOnly yes--appendonly.aof stored data is generated by default
MaxClients 180000
Save ""


At the end of the Redis configuration from, Redis.conf adds

Include/data/redis/6379/instance.conf

And then the content in the instance.conf of the lateral

AppendOnly yes--appendonly.aof stored data is generated by default
Save ""
Slaveof 10.104.5.98 6379---The address is the primary address.



Redis configuration Detailed-Client buffer output buffer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.