gpt4 book ai didi

performance - Redis 客户端最大限制

转载 作者:IT王子 更新时间:2023-10-29 06:04:31 25 4
gpt4 key购买 nike

我在我的应用程序中使用了 redis 发布/订阅机制,想做一个基准测试。我有一台 I-7 机器,内存为 32 GB,ulimit 设置为 1024。Redis 服务器的配置相同,只是 ulimit 设置为 65535。我可以同时建立多少个连接,而 redis 不会提示 MAXClient 达到异常。我尝试使用连接池等调整连接,但同时请求的数量似乎没有超过 25K 个请求。

谢谢\

最佳答案

From REDIS Documentation

最大客户端数

In Redis 2.4 there was an hard-coded limit about the maximum number of clients that was possible to handle simultaneously.

In Redis 2.6 this limit is dynamic: by default is set to 10000 clients, unless otherwise stated by the maxmemory directive in Redis.conf.

However Redis checks with the kernel what is the maximum number of file descriptors that we are able to open (the soft limit is checked), if the limit is smaller than the maximum number of clients we want to handle, plus 32 (that is the number of file descriptors Redis reserves for internal uses), then the number of maximum clients is modified by Redis to match the amount of clients we are really able to handle under the current operating system limit.

When the configured number of maximum clients can not be honored, the condition is logged at startup as in the following example:

$ ./redis-server --maxclients 100000

[41422] 23 Jan 11:28:33.179 # Unable to set the max number of files limit to 100032 (Invalid argument), setting the max clients configuration to 10112.

When Redis is configured in order to handle a specific number of clients it is a good idea to make sure that the operating system limit to the maximum number of file descriptors per process is also set accordingly.

Under Linux these limits can be set both in the current session and as a system-wide setting with the following commands:

  • ulimit -Sn 100000 # This will only work if hard limit is big enough.

  • sysctl -w fs.file-max=100000

关于performance - Redis 客户端最大限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32486500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com