2

我的应用程序采用 redis 作为缓存,redis-py 作为客户端来访问它。在一个特殊请求中将调用 65 次 redis 访问,包括 LRANGE、GET、LLEN。

在 4 req/s 的测试下,该命令redis-cli client list | wc -l在测试运行期间始终显示 3 个连接。但是当并发 req 增加到 50 req/s 时,会显示 redis 客户端连接数随着测试运行而增加。在 3 分钟的持续时间内,连接数将增加到 1000+。结果,我的应用程序的性能急剧下降。

那么问题的原因可能是什么?任何建议表示赞赏。

redis-benchmark -n 100000 -q 的结果是

PING_INLINE: 73637.70 requests per second
PING_BULK: 75414.78 requests per second
SET: 75301.21 requests per second
GET: 75528.70 requests per second
INCR: 75930.14 requests per second
LPUSH: 76103.50 requests per second
LPOP: 74074.07 requests per second
SADD: 75301.21 requests per second
SPOP: 74794.31 requests per second
LPUSH (needed to benchmark LRANGE): 75301.21 requests per second
LRANGE_100 (first 100 elements): 38182.51 requests per second
LRANGE_300 (first 300 elements): 15128.59 requests per second
LRANGE_500 (first 450 elements): 11152.00 requests per second
LRANGE_600 (first 600 elements): 8797.40 requests per second
MSET (10 keys): 42936.88 requests per second

app和redis运行在同一个虚拟主机上,基础环境为E5-2620 * 2 CPU,4G Mem。

4

0 回答 0