数据库
首页 > 数据库> > redis优化记录

redis优化记录

作者:互联网

某日,DBA发现针对redis的ttl操作过多,如下:

1585835992.720145 [2 10.160.91.30:9291] "TTL" "activity::activity_price:7:71302"
1585835992.721121 [2 10.160.82.69:51447] "TTL" "activity::activity_price:7:72147"
1585835992.721170 [2 10.160.91.30:26069] "TTL" "activity::activity_price:7:49075"
1585835992.721654 [0 10.160.91.30:57862] "SELECT" "2"
1585835992.721678 [2 10.160.91.30:9291] "GET" "activity::activity_price:7:71302"
1585835992.722339 [2 10.160.82.69:51447] "TTL" "activity::activity_price:7:71675"
1585835992.722592 [2 10.160.91.30:26069] "GET" "activity::activity_price:7:49075"
1585835992.723112 [2 10.160.91.30:57862] "TTL" "activity::activity_info:7"
1585835992.723229 [2 10.160.91.30:9291] "TTL" "activity::activity_price:7:70826"
1585835992.723551 [2 10.160.82.69:51447] "TTL" "activity::activity_price:7:141"
1585835992.724038 [2 10.160.91.30:26069] "TTL" "activity::activity_price:7:50901"
1585835992.724610 [2 10.160.91.30:57862] "GET" "activity::activity_info:7"

经查代码发现是下面的代码造成的:(在每次get数据的时候都会进行ttl操作,这样使得ttl操作变得很多,redis的qps访问量很高)

 

后来我问DBA,qps过高对咱们有什么影响啊?

DBA:会导致cpu使用率增加很多。

我:cpu使用率增加很多对咱们有什么影响啊?

DBA:使用率高,响应就会变慢啊。如果流量很高,cpu跑满也是有可能。目前单机的大概能支撑几万qps,集群版随节点数翻倍。

标签:记录,DBA,91.30,price,TTL,redis,activity,10.160,优化
来源: https://www.cnblogs.com/cjjjj/p/12655608.html