redis限制注意点

Posted aoerqilengbai

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redis限制注意点相关的知识,希望对你有一定的参考价值。

使用CONFIG SET timeout 控制客户端连接超时
对于客户端的连接输出量有限制
There are two kind of limits Redis uses:
The hard limit is a fixed limit that when reached will make Redis closing the client connection as soon as possible.
The soft limit instead is a limit that depends on the time, for instance a soft limit of 32 megabytes per 10 seconds means that if the client has an output buffer bigger than 32 megabytes for, continuously, 10 seconds, the connection gets closed.
Different kind of clients have different default limits:
Normal clients have a default limit of 0, that means, no limit at all, because most normal clients use blocking implementations sending a single command and waiting for the reply to be completely read before sending the next command, so it is always not desirable to close the connection in case of a normal client.
Pub/Sub clients have a default hard limit of 32 megabytes and a soft limit of 8 megabytes per 60 seconds.
Slaves have a default hard limit of 256 megabytes and a soft limit of 64 megabyte per 60 second.
It is possible to change the limit at runtime using the CONFIG SET command or in a permanent way using the Redis configuration file redis.conf. See the example redis.conf in the Redis distribution for more information about how to set the limit.
查询buffer也有限制,最大1GB
安装的时候要设置swap
Make sure to setup some swap in your system (we suggest as much as swap as memory). If Linux does not have swap and your Redis instance accidentally consumes too much memory, either Redis will crash for out of memory or the Linux kernel OOM killer will kill the Redis process.

 

以上是关于redis限制注意点的主要内容,如果未能解决你的问题,请参考以下文章

你必须知道的 21 个 Redis 注意点!

redis异常和注意点

redis5 别的操作及注意点

生产环境中使用docker注意点

c++11新特性注意点

mysql 注意点