전체 글
-
10장 - 이벤트📕 book/도메인 주도 개발 시작하기 2023. 1. 16. 09:44
📌 시스템 간 강결합 문제 외부에서 제공하는 서비스를 파라미터로 전달받고 도메인 기능에서 도메인 서비스를 실행할 경우 문제가 발생할 수 있다. 외부 서비스가 정상이 아닐 경우 트랜잭션 처리를 어떻게 해야 할지 애매하다는 것이다. 외부 기능을 실행하는 과정에서 익셉션이 발생할 경우 롤백 or 커밋 중에 무엇을 해야 할까 ❓ ex) 환불 서비스를 실행하는 경우 외부의 환불 서비스를 실행하는 과정에서 익셉션이 발생하면 환불에 실패했으므로 주문 취소 트랜잭션을 롤백하는 것이 맞을 것 같지만 반드시 트랜잭션을 롤백 해야 하는 것은 아니다. 주문은 취소 상태르 변경하고 환불만 나중에 다시 시도하는 방식으로 처리할 수도 있다. 2. 성능 문제 외부 시스템의 응답 시간이 길어지면 그 만큼 대기 시간도 길어진다. 즉, ..
-
9장 - 도메인 모델과 바운디드 컨텍스트📕 book/도메인 주도 개발 시작하기 2023. 1. 13. 22:09
📌 도메인 모델과 경계 한 도메인은 여러 하위 도메인으로 구분된다. 따라서, 한 개의 모델로 여러 하위 도메인을 모두 표현하려고 하면 오히려 모든 하위 도메인에 맞지 않는 모델을 만들게 된다. 하위 도메인마다 사용하는 용어가 다르기 때문에 올바른 도메인 모델을 개발하려면 하위 도메인마다 모델을 만들어야 한다. 모델은 특정한 컨텍스트(문맥) 하에서 완전한 의미를 갖는다. 컨텍스트마다 의미가 서로 다를 수 있다. 이렇게 구분되는 경계를 갖는 컨텍스트를 바운디드 컨텍스트(Bounded Context)라고 한다. 📌 바운디드 컨텍스트(Bounded Context) 바운디드 컨텍스트는 모델의 경계를 결정하고 한 개의 바운디드 컨텍스트는 논리적으로 한 개의 모델을 갖는다. 용어를 기준으로 구분 서로 다른 용어를 사..
-
🌊 Connection Pool🌱 spring 2023. 1. 13. 16:26
인프런 김영한 님의 스프링 DB 1 강의를 듣고 정리한 글 (결제하고 못 들은 강의 듣고 다시 내용 정리하기) 커넥션풀 ❓ 데이터베이스 커넥션을 획득 과정 DB 드라이버를 통해 커넥션 조회 TCP/IP 커넥션 연결 (DB 드라이버 - DB) 커넥션이 연결되면 Id, PW와 같은 부가정보 DB에 전달 내부 인증을 완료 후 내부에 DB 세션 전달 DB는 커넥션 생성 완료 응답을 보낸다. DB 드라이버는 커넥션 객체를 생성해 클라이언트에 반환 매번 커넥션을 새로 만드는 것은 매우 복잡하고 시간도 많이 걸린다. ⇒ 커넥션을 미리 생성해두고 사용하는 ‘커넥션 풀’ 이라는 방법을 사용. 커넥션 풀 초기화 애플리케이션을 시작하는 시점에 커넥션 풀은 필요한 만큼 커넥션을 미리 풀에 보관 default - 10개 ❗커넥..
-
JDBC ❓🌱 spring 2023. 1. 13. 15:11
인프런 김영한 님의 스프링 DB 1 강의를 듣고 정리한 글 (아직 듣지 않고 결제한 강의 들으면서 다시 정리하기) ❓JDBC 애플리케이션을 개발 시 데이터는 대부분 데이터베이스에 저장한다. 애플리케이션 서버와 DB - 일반적인 사용법 1. 커넥션 연결 주로 TCP/IP를 사용해서 커넥션을 연결한다. 2. SQL 전달 애플리케이션 서버는 DB가 이해할 수 있는 SQL을 연결된 커넥션을 통해 DB에 전달한다. 3. 결과 응답 DB는 전달된 SQL을 수행하고 그 결과를 응답한다. 애플리케이션 서버는 응답 결과를 활용한다. ⚠️ 문제 : 데이터베이스마다 커넥션 연결 방법, SQL 전달 방법, 결과 응답받는 방법이 모두 다르다. ⇒ 다른 종류의 DB로 변경시 애플리케이션 서버에 개발된 DB 사용 코드도 함께 변경..
-
8장 - 애그리거트 트랜잭션 관리📕 book/도메인 주도 개발 시작하기 2023. 1. 12. 22:32
📌 애그리거트와 트랜잭션 한 애그리거트를 두 사용자가 동시에 변경할 경우 애그리거트의 일관성이 깨질 수 있다. 일관성이 깨지는 문제가 발생하지 않도록 하려면 아래 두 가지 중 하나를 해야 한다. 사용자 1이 정보를 조회하고 상태를 변경하는 동안 사용자2가 애그리거트를 수정하지 못하게 막는다 사용자1이 정보를 조회한 후 사용자2가 정보를 변경하면, 사용자1이 애그리거트를 다시 조회한 뒤 수정하도록 한다. DBMS가 지원하는 트랜잭션과 함께 애그리거트를 위한 추가적인 트랜잭션 처리 기법이 필요하다!! 대표적인 트랜잭션 처리 방식에는 선점, 비선점 잠금의 두 가지 방식이 있다. 🙅🏻 선점 잠금 💡 선점 잠금(Pessimistic Lock) - 먼저 애그리거트를 구한 스레드가 애그리거트 사용이 끝날 때까지 다른..
-
7장 - 도메인 서비스📕 book/도메인 주도 개발 시작하기 2023. 1. 12. 21:04
📌 여러 애그리거트가 필요한 기능 도메인 영역의 코드를 작성하다 보면, 한 애그리거트로 기능을 구현할 수 없을 때가 존재한다. ex) 결제 금액 계산 로직 상품 애그리거트 : 구매하는 상품의 가격 주문 애그리거트 : 상품별 구매 개수 항인 쿠폰 애그리거트 : 쿠폰별로 할인 금액, 비율에 따른 주문 총 금액 회원 애그리거트 : 회원 등급에 따라 추가 할인이 가능하다 여기서 실제 결제 금액을 계산하는 로직의 주체는 어떤 애그리거트인가 ❓ → 이렇게 한 애그리거트에 넣기 애매한 도메인 기능을 억지로 특정 애그리거트에 구현하면 안된다. 억지로 구현하게 되면 애그리거트는 자신의 책임 범위를 넘어서는 기능을 구현하는 것이므로 코드가 길어지고 외부에 대한 의존이 높아지게 되며 코드를 복잡하게 만들어 수정이 어려워진다..
-
2장 - 카프카 빠르게 시작해보기📕 book/아파치 카프카 2023. 1. 12. 18:05
📍 AWS EC2 인스턴스 발급 및 보안 설정 AWS에서 카프카를 구축하는 2가지 방법 MSK(Managed Service Kafka) 사용 EC2에서 설치 및 실행 MSK AWS에서 공식적으로 지원하는 완전 관리형 카프카 서비스 간단한 콘솔 세팅으로 AWS에서 카프카 설치 및 실행을 자동화해준다. 실습을 위한 카프카를 위해서 실행되는 프로세스 : 주키퍼, 카프카 브로커 카프카 브로커의 기본 포트는 9092, 주키퍼의 기본 포트는 2181이다. EC2에 설치하는 브로커에 접속하기 위해서는 AWS EC2의 보안그룹의 Inbound 설정에 9092와 2181 포트를 열어야 한다. 실습용이므로 모든 IP로부터 접속 가능하도록 설정 주키퍼 💡 주키퍼는 분산 코디네이션 서비스를 제공하는 오픈소스이다. 분산 코디네..
-
[팔꿈치 탈골] 클라이밍 하다 다친 사람..🤕일상😎 2023. 1. 9. 23:34
작년 크리스마스를 맞이해 연합 동아리 사람들과 클라이밍을 하기로 했다...!! 🧗♂️ 이전까지 클라이밍을 말로만 듣고 직접 해보지 않아서 정말 재미있게 하고 이번 기회로 꾸준히 하고자 참여했다. 스트레칭도 열심히 배우고 기본적인 자세들을 배우고 쉬운 난이도부터 시작했다. 쉬운 난이도를 몇 번 해결하고 나니 자신감도 생기고 더 어려운 것들도 하고자 하는 의지가 불탔다 🔥 (이때 조금 더 신중했어야 했다) 점프 도전 ❗️ 이제껏 했던 난이도보다 더 어려운 난이도를 도전하면서 점프를 해야 하는 상황이 생겼다. 나를 케어해 주던 일행이 먼저 터치만 하고 오라는 말을 했지만 나는 무슨 자신감인지 모르겠지만 한 번에 잡아보려고 했다. 점프를 하고 잡긴 개뿔 바로 실패하고 나는 그대로 오른쪽 팔부터 떨어졌다. 솔직..