3-4주차 과제#94
Closed
hongs429 wants to merge 29 commits intohanghae-skillup:mainfrom
Hidden character warning
The head ref may contain hidden characters: "3\uc8fc\ucc28-\uacfc\uc81c"
Closed
Conversation
- CinemaCommandAdapter 에 TODO 남김(exception 처리를 위한 공통 모듈 필요성) - 각 모듈 별로 독립적인 cinema 생성 코드 작성
- 간단하게 application 테스트 코드 추가
- 각 모듈 별 테스트 환경 구축
- 최소한의 도메인 생성 시, 검증 로직 추가
- 이번 프로잭트의 취지에 맞도록 foreign key 참조는 전부 제거
- flyway 로 foreign key 제거 후 이력 관리
- application 레벨에서 키를 관리
- application 레벨에서 키를 관리함을 명시적으로 설정
- foreignKey = @foreignkey(value = ConstraintMode.NO_CONSTRAINT)
- 곁다리로 임시 데이터 생성 스크립트 주석 처리(지우긴 아쉬워)
- 간단한 테스트 실행. - 그라파나 대시보드 기본적인 것 간단하게 구성 - 아직은 k6의 메트릭에 대한 이해가 필요...
- 모듈 간의 의존관계
- presentation -> application <- infrastructure (큰 흐름)
- presentation -> domain : application의 응답을 도메인 모델로 받기 위함
- application -> domain : application 에서는 프로그램의 흐름을 제어하는 서비스로직 담당, 도메인의 로직(도메인 내부 메서드), 도메인 간의 상호 로직(추 후, domain service로 명명)은 해당 모듈에서 가지고 오도록 하여, applicaiton은 오로지 프로그램의 흐름을 제어하는 로직이 들어가도록 설정
- infrastructure -> domain : applicaton 모듈의 요청을 특정기술의 모델(ex> jpaEntity)이 아닌 domain 엔티티로 전달하기 위함
- presentation -> infrastructure : 단순히 infrastructure의 빈들을 application에서도 사용가능하도록 등록하기 위함.
- 해당 구조에 맞게 클래스 파일의 이동
- controller 검증항목 : 알맞은 파라미터 바인딩이 되는가 && 결과를 응답에 맞게 만드는가 && 응답 코드는 일치하는가
- Q클래스는 기본적으로 $buildDir/generated/sources/annotationProcessor를 따라감. 때문에 별도의 설정 필요없음.
- 8.11.1 문법에 맞게 tasks.withType(JavaCompile) { => tasks.withType(JavaCompile).configureEach { 로 변경
- 현재 deserialization이 정상적으로 이루어지지 않음.
…is 포트 수정 && 부하테스트 스크립트 작성(load_test.js) - 리스트 데이터를 serialize 하는 경우, custom objectmapper를 사용하므로써 해결 - 명확한 이유는 모르겠으나, redis 포트 변경 후 정상 작동 - 부하테스트 확인
…국제화 적용 - GlobalExceptionHandler 정의 - 국제화 도입
- 도메인 로직, application 로직 분리 - Reservation 관련 도메인, jpa 엔티티 만들기 - Flyway로 DDL 반영 - 예외 정의 - 테스트 코드 작성
…key로 동시성 해결 - 테스트 코드로 동시성 검증 - Infra 테스트 환경 구축( test container )
- redission 세팅 - 테스트 코드로 동시성 검증
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
[예약 시스템 구현 및 동시성 제어]
작업 내용
예약과 관련된
application,infra모듈 작업 (presentation미완성)동시성 해결을 위한 이중 방어 적용
ReservationCommandAdapter.reserve(MySQL) → Unique 제약 조건으로 동시성 제어ReservationLockPort(Redisson) → Application 레벨에서 분산 락 적용테스트 전략
application: 단위 테스트 (입력 모델 검증 + 비즈니스 로직 검증)infra:ReservationCommandAdapter.reserve단위 테스트application -> infra경로를 거치는 통합 테스트 진행발생했던 문제와 해결 과정
🚨 문제 1: 통합 테스트를 어떤 모듈에서 작성해야 하는지 고민
application은infra를 모르므로,infra에서 작성해야 하는지 모호함infra는application을 알고 있고 DB 관련 내용도 포함하므로, 통합 테스트는infra에서 작성하는 것으로 결정infra에서는application -> infra가 자연스럽게 연결될 수 있음🚨 문제 2: 락을
application과infra중 어디서 적용할지 고민persistence)에서 락을 걸어야 할까?application레벨에서 비즈니스 로직을 보호해야 할까?ReservationLockPort를application과infra에서 분리application에서 비즈니스 로직 전에 락을 먼저 시도, 이후infra에서 DB 트랜잭션 처리🚨 문제 3: Redisson의
waitTime이 길 경우, 이미 예약된 좌석이 있어도 계속 예약 시도waitTime)이 길면, 이미 예약된 좌석에 대해서도 중복 예약 시도가 발생waitTime을 짧게 설정이번 주차에서 고민되었던 지점이나, 어려웠던 점
infra에서application -> infra흐름을 테스트하는 것이 적절application에 둘지infra에 둘지 판단하는 것이 어려웠음application까지 트랜잭션 전파가 필요할 가능성 존재리뷰 포인트
infra에서 통합 테스트를 작성한 것이 적절한 판단인지?application에서는 트랜잭션을 전파하지 않도록 구현했는데, 이는 올바른 설계인가?application까지 트랜잭션을 잡아야 할 가능성 존재기타 질문
waitTime이 필요한 이유가 명확하지 않음waitTime을 짧게 설정하여 동시 요청을 제한