Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
작업 내용 #9
ApplicationEventPublisher 사용이유
조회수 데이터는 중요도가 낮은 비즈니스 로직이기 때문에, 유실되더라도 시스템 전체에 지장이 없다고 판단했습니다. 조회수는 실시간으로 정확할 필요는 없으며, 어느 정도의 오차는 허용 가능하므로 안정성이 완벽하게 보장될 필요가 없습니다.
조회수 증가와 같은 가벼운 로그를 저장하는 작업에는 Redis나 Kafka를 사용하지 않아도 충분한 성능을 낼 수 있습니다. 더해서 비용적인 측면에서도 매니지먼트 서비스를 사용하지 않기때문에 비용측면에서도 효율적이라고 생각합니다.
ApplicationEventPublisher를 사용하면 필요 시에 다른 메시징 시스템(kafka, rabbitmq 등)으로 쉽게 변경할 수 있습니다.
Redis로 배치처리하면 즉각적으로 반영 못합니다. 그러나 이벤트를 통해 비동기 처리를 즉각 반영도 가능합니다.
지금은 Redis캐시로 조회수를 실시간으로 업데이트한 개수를 보여주지는 않지만 ttl이 끝나면 반영되기때문에 추후 실시간 반영이 필요한 경우에도 유용하다고 생각했습니다.