事故原因:
运维报告redis内存直线上升,然后查询发现都是setrange操作,review代码,没法发现setrange操作
代码如下:
redisTemplate.opsForValue().set(groupid+xxxResult.getSeriesNo(), JSON.toJSONString(xxxRquestDTO),1000*60L)
赶紧查一下api:
set(K key, V value, long offset)
Overwrite parts of
key starting at the specified offset with given value.开发的本意设置超时时间,改成这个api:
set(K key, V value, long timeout, TimeUnit unit)
Set the
value and expiration timeout for key.快速上线后问题解决。
分析:
3.其实中间件封装好了,不需要设置时间单元,但因这次是旧项目改造,直接使用spring-data-redis导致的。