Redis

Redis 성능 차이 비교

초록색거북이 2023. 3. 8. 15:30
728x90
반응형
SMALL

Redis를 사용하면 얼마나 성능 차이가 있을지 궁금해서 확인해보았다.

 

개발환경

 - Springboot 3.0.4v

 - JDK 17

 - 약 10000개 가량의 더미데이터

 

 

Controller

//@RequestMapping("/api/v1/redis")


@GetMapping("")
public ResponseEntity<?> selectRedis(){
        long startTime = System.currentTimeMillis();
        List<Member> result = memberService.selectRedis();
        log.info("캐시 적용 전 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 전 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 전 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 전 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 전 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 전 :" + (System.currentTimeMillis() - startTime)+ "ms");
        return ResponseEntity.ok().body(result);

//RequestMapping("/api/v1/redis")


@GetMapping("")
    public ResponseEntity<?> selectRedis(){
        long startTime = System.currentTimeMillis();
        List<Member> result = memberService.selectRedis();
        log.info("캐시 적용 후 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 후 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 후 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 후 :" + (System.currentTimeMillis() - startTime)+ "ms");
        log.info("캐시 적용 후 :" + (System.currentTimeMillis() - startTime)+ "ms");
        return ResponseEntity.ok().body(result);
    }

 

 

결론

 

4~5 배 정도 성능 차이가 있는 것으로 보인다.

 

728x90
반응형
LIST