- 목적 : Redis의 성능에 영향을 미치는 것들은 무엇이 있을까?
01. 적절한 Eviction 정책 설정하기
- 어떤 정책을 설정하더라고 데이터를 날릴 수 있다는 점이 있겠지만,
- 캐시로 단순히 Redis를 사용하는 경우에는 적절한 eviction policy 가 사용될 수 있다.
- maxmemory
- 64 bit에서는 사실상 표현할 수 있는 데이터 공간이 크기 때문에 무제한으로 설정된다.
- maxmemory : maxmemory에 도달한 경우 삭제하는 정책
- volatile : expire 가 true임
- allkeys-lru : Redis에서 가장 흔히 사용. 캐싱용도로 사용되는 경우 가장 최근에 사용되는 게 이후에 사용될 확률이 높으므로
- allkeys-random : 값들이 균등하게 사용되는 경우 사용
- volatile과 allkeys가 나눠진 이유는? 캐싱 성격을 가신 성격이 다르므로 나눠져서 사용함
- lru : 정확한 값보다는 대략적인 확률로 계산함 (↔ 정확하면 비용이 증가하므로)
⇒ 결국, 사용자의 요구 사항에 따라서 결정하면 됨.