목록2024/09/01 (2)
밤빵's 개발일지
결제기능을 구현하면서, 동시성문제와 멱등성에 대해서 알게됐는데 이름부터 너무 생소해서 이걸 어떻게 공부해야하나 걱정부터 앞서던 중 기술매니저님 께서 PUT과 PATCH를 생각하면 이해하기 쉬울거라고하셔서 연관지어 개발일지를 작성하게 되었다. 코드 예시는 내 서비스 코드를 사용했는데.. 기능 구현이 너무너무 안되고 있다😢멱등성(Idempotency) 문제는 결제 시스템을 구현할 때 중요한 개념이다. 멱등성은 같은 요청을 여러 번 반복해서 보내더라도 결과가 변하지 않는 성질을 의미하는데, 특히 결제 시스템에서는 멱등성을 보장하는 것이 매우 중요하다. 같은 결제 요청이 여러 번 처리되면 고객에게 중복된 결제가 발생할 수 있기 때문이다. 이 멱등성을 이해하기 위해서 HTTP메서드인 PUT과 PATCH와 연관지..
N+1 문제를 굳이굳이 발생시키고도 감을 못잡아서 결국 기술매니저님께 숙제를 다시 받아버렸다. 꼭 해결해보기로! 직접 해결방법까지 보여주셨지만 또 버벅거려서 시온님께 다시 여쭤보고 현재 진행하고 있는 팀 프로젝트에 적용해봤다. 🤓N+1 문제 발생과 해결 과정▶ 기술매니저님이 보여주신 예시 분석!→ TestEntity 클래스가 ProductEntity와 @OneToMany 관계로 설정되어 있고, fetch = FetchType.LAZY로 지연 로딩이 설정되어 있다. ▷ 관련 설명 → Service Layer (TestService):TestService 클래스의 test() 메서드는 TestEntity를 조회한 후 entity.getTestEntities()를 호출하고 있다. fetch = Fetch..