간단한 영화 목록 조회입니다. 총 약 10000개의 데이터가 있습니다. redis를 적용하고 조회성능이 좋아진것은 맞지만 이상하게 redis를 적용하기 전에도 같은 조회를 계속해도 조회속도가 똑같이 빨라지는 현상을 겪고있습니다. 현재 이 movie는 MSA 의 여러 서비스 중 하나입니다. 혹시 MSA 아키텍쳐 자체가 문제가 될 수도 있나요? @Cacheable(cacheNames = "getMovies", key = "'movie:all'", cacheManager = "movieCacheManager") public List<Movie> getAllMovies() { return movieRepository.findAll(); } @GetMapping("/movies") public ResponseEntity<List<MovieDto>> getAllMovies() { List<Movie> allMovies = movieService.getAllMovies(); List<MovieDto> dtos = new ArrayList<>(); for (Movie movie : allMovies) { dtos.add(new ModelMapper().map(movie, MovieDto.class)); } return ResponseEntity.status(HttpStatus.OK).body(dtos); } @Configuration @EnableCaching // Spring Boot의 캐싱 설정을 활성화 public class RedisCacheConfig { @Bean public CacheManager movieCacheManager(RedisConnectionFactory redisConnectionFactory) { RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration .defaultCacheConfig() // Redis에 Key를 저장할 때 String으로 직렬화(변환)해서 저장 .serializeKeysWith( RedisSerializationContext.SerializationPair.fromSerializer( new StringRedisSerializer())) // Redis에 Value를 저장할 때 Json으로 직렬화(변환)해서 저장 .serializeValuesWith( RedisSerializationContext.SerializationPair.fromSerializer( new GenericJackson2JsonRedisSerializer() ) ) // 데이터의 만료기간(TTL) 설정(1분) .entryTtl(Duration.ofMinutes(1L)); return RedisCacheManager .RedisCacheManagerBuilder .fromConnectionFactory(redisConnectionFactory) .cacheDefaults(redisCacheConfiguration) .build(); } } @Configuration public class RedisConfig { @Value("${spring.data.redis.host}") private String host; @Value("${spring.data.redis.port}") private int port; @Bean public LettuceConnectionFactory redisConnectionFactory() { return new LettuceConnectionFactory(new RedisStandaloneConfiguration(host, port)); } }
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.5.3.jar:3.5.3] Caused by: org.springframework.data.redis.listener.adapter.RedisListenerExecutionFailedException: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis at org.springframework.data.redis.listener.RedisMessageListenerContainer.lazyListen(RedisMessageListenerContainer.java:383) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.listener.RedisMessageListenerContainer.start(RedisMessageListenerContainer.java:361) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:405) ~[spring-context-6.2.8.jar:6.2.8] ... 19 common frames omitted Caused by: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1858) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1789) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceC Redis 에러 (백엔드 에러는 이렇게 뜨고) 프론트 엔드 (로그인 하고 들어가는 거 잘됩니다. 채팅만 치면 저렇게 뜹니다.) EC2에서 redis 접속은 잘 됩니다. 프론트는 S3+cloudfront (도메인 적용 안함) 백엔드는 Redis(Elastic) + EC2+RDS +nginx 로 배포했고 몇시간 쨰 하는데 저 에러가 뜹니다. 혹시 프론트 배포가 잘 못 된건가요? 강사님 도와주세여ㅠㅠㅠ
Caused by: org.springframework.data.redis.listener.adapter.RedisListenerExecutionFailedException: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis at org.springframework.data.redis.listener.RedisMessageListenerContainer.lazyListen(RedisMessageListenerContainer.java:383) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.listener.RedisMessageListenerContainer.start(RedisMessageListenerContainer.java:361) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:405) ~[spring-context-6.2.8.jar:6.2.8] ... 19 common frames omitted Caused by: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1858) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1789) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1586) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.lambda$getConnection$0(LettuceConnectionFactory.java:1566) ~[spring-data-redis-3.5.1.jar:3.5.1] at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.doInLock(LettuceConnectionFactory.java:1527) ~[spring-data-redis-3.5.1.jar:3.5.1] 위에꺼는 백엔드 서버 에러이고 밑에는 프론트엔드 서버 에러입니다. 안녕하세요 강사님 채팅 서버와 프론트를 배포를 해서 Elastic Cache를 이용을 하고 있는데 EC2 랑 연결이 잘 되어 있으면서도 이런 에러가 뜹니다. 아무리 찾아봐도 더 해결사항이 보이지 않아 질문드립니다.
선생님 코드 복붙했는데 어느 부분이 틀린지 잘 모르겠습니다. class RedisCacheConfig 부분에서 RedisConnectionFactory redisConnectionFactory 이 부분이 에러가 나고 class BoardService애서 cacheManager = "boardCacheManager" 여기서도 에러가 납니다. 파일 첨부합니다.
안녕하세요, 좋은 강의제공 감사드립니다! 강의 듣다가 실무적용할때 궁금한점이 있어서 질문남겨봅니다. 결제와 같이 성능테스트 대상으로 삼기 애매한 API에 대한 테스트 방법이 궁금합니다. api 호출 시 결제가 이루어진다거나 타 제휴사 api 를 친다거나 하는 경우 성능테스트를 진행해버리면 문제가 생기지 않을까 싶은데요, 이런경우에는 보통 어떻게 성능테스트를 진행하고 병목구간을 찾아야 할까요? 감사합니다:D
강사님 안녕하세요. 강사님 덕분에 배운대로 잘 사용하고 있습니다. 그중 제가 해석이 강사님과 다른 지점이 있어서 질문을 남깁니다. 강사님은 CPU코어가 2개여서 Max 200%까지 된다고 했는데 저는 1:1 비율로 사진과 똑같더라고요. 다른 점은 강사님은 EC2 설계 시 T3.small을 저는 t2를 선택했는데 그것에 따라 다른 것일까요? 아님 저는 node인데 강사님은 java여서 그에 대한 차이일까요?
사진과 같이 강사님과 똑같이 그리고 제공해준 실습 자료를 복사 붙여넣기하면서 따라하고 있는데 저기 sudo nohup java -jar jscode-0.0.1-SNAPSHOT.jar & 설치에서 강사님은 엔터를치면 ip를 확인할 수 있는 코드를 치면 나오는데 저는 exit 1 등이 뜨면서 설치가 안됩니다. 제가 잘못한 것이 있나요? node 유저라서 자바는 잘 모릅니다.