SlideShare uma empresa Scribd logo
1 de 136
Baixar para ler offline
Event-Storming based MSA
training
Copyright © 2018. Jinyoung Jang & uEngine-solutions All rights reserved.
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
3
• 상호명 :  12번가
• Vision  &  Mission
“고객으로부터 신뢰받는 최고의 커머스 포털”
Target Domain : 온라인 쇼핑몰 (12번가)
• 우리는 세상 모든 것을 판매하는 쇼핑의 관문으로의
진화를 꿈꿉니다.  고객이원하는 모든유형의 상품과
서비스를 만날 수 있는 곳,  바로 12번가입니다.
• 우리는 우리의 기술로 탐색부터 구매까지,  쇼핑의 모
든 과정에서 고객에게 최적의솔루션을제공할수 있
을 것이라 믿습니다.  쇼핑에 관한절대적인편의를제
공하는 곳,  바로 12번가입니다.
• 우리는 고객의 슬기로운 쇼핑생활을 위해끊임없이
노력하고 있습니다.  풍성한 콘텐츠로 쇼핑그 이상의
재미와 감동을 선사하는 곳,  바로12번가입니다.
4
12번가 User Stories
• MD가 상품정보(상품ID,  상품명,  상품가격,  재고수량,  설명,  추천ID)를 등록/  수정/  삭제한다.
• 고객이 주문과 취소를 함에 따라서 상품 재고량이 변경된다.
• 고객이 상품명으로 조회 시,  상품정보가 조회 된다.
• 시스템이 상품을 출력할 때,  추천 상품들이 동시에 출력된다.
• 품절된 상품에 대해서는 구매 대기가 가능하다.
• 품절된 상품이 재 입고될 때,  구매 대기 목록에 있는 고객에게 알림이 발송된다.
• 고객이 상품관련 질문을 올리면 MD가 회답한다.
• 고객이 상품을 장바구니에 담는다.
• 고객이 주문할 때,  상품과 구매개수 및 옵션을 선택한다.
• 고객이 주문내역 변경(수정,  취소)이 가능하다.
• 주문상태가 변경될 때마다 고객에게 알림이 가야 한다.
• “카드결제” 결제 시 결제대행사가 한도체크 및 결제행위를 실행된다.
• 주문취소가 완료되면 결제된 금액은 자동으로 환불된다.
• 시스템은 결제 완료된 주문의 배송 정보를 물류사에 전달한다.
• 배송정보에는 상품ID,  주문정보,  고객정보 등의 내용이 포함된다.
• 고객이 배송중인 상품에 대해 배송현황 조회가 가능하다.
• 고객이 입력한 배송관련 질의사항은 배송팀에서 대응한다.
• 시스템은 고객의 배송완료 또는 반품완료 시,  고객에게 상태 알림을 제공한다.
• 주문취소는 주문상품 반품,  환불완료가 되면 최종 주문취소가 완료된다.
• 고객의 상품관련 컴플레인은 상품관리팀에게 연결이 된다.
• 구매자에 대해,  잦은 주문 (승인 및 취소)  반복 시 블랙리스트로 등록되고,  등록된 사용자는 주문 시에 대한 규제를 가한다.
• 판매자에 대해,  물품 배송이 자주 지연될 경우(기간 내 몇 회 이상),  잘못된 정보로 홍보할 경우(기간 내 몇 건 이상),  고객 불만
사항이 많을 경우(기간 내 몇 건 이상),  판매자가 블랙리스트로 될 경우 상품 등록 시 규제를 가한다.
• 모든 비즈니스 메일은 마케팅 관리팀에서 발송을 담당한다.
5
Teaming & KPI Definition
상품관리팀
주문/결제관리팀
배송관리팀12 번가
고객센터팀
마케팅팀
가성비 높은 상품 제공 통한 매출 증대
안정되고 정확한 주문/취소를 통한 고객 만족
빠른 배송 추적 통한 고객 만족
고객 불만 대응성
고객 맞춤화된 상품 제공통한 구매력 증대
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
AS-IS: Pain-points
• 운영팀과 개발팀이 분리되어 개발팀의 반영을 운영팀이
거부하는 사례 발생
• 개발팀은 새로운 요건을 개발했으나, 이로인해
발생하는 오류가 두려워 배포를 꺼려함
• 현재 미국, 일본, 유럽 등 수요가 늘어나는 상황이나,
상기한 문제로 신규 고객의 요구사항을 받아들이지
못하는 상황
• 수동 운영의 문제로, SLA 준수가 되지 못하여 고객
클레임이 높은편
• 기존 모놀로씩 아키텍처의 한계로 장기적인 발전의
한계에 봉착
• 서비스 업그래이드가 수시로 요청이 들어와 거의
매일 야근중. 개발자 행복지수가 매우 낮음.
• 한팀의 반영이 전체팀의 반영에 영향을 주어 거의
매일 야근해야 함. 행복지수 낮음을 토로함.
• 테넌트별 다형성 지원을 제대로 하지 못하여
가입고객이 늘 때마다 전체 관리 비용이 급수로
올라가는 한계에 봉착함
• 자체 IDC를구성하여 하드웨어, 미들웨어 구성을
직접해야 하는 비용문제.
8
Ⅱ. AgileValue& Principles
Delivery
&
Requirement
management
MVP(Minimum Viable Product)
&
Incremental   delivery
S/W  
Engineering
Test driven  
Development  
&
Continuous  
Refactoring  
Technical
Design
Loosely   Coupled  
Architecture
Process  
&
Collaboration
Continuously  
Improving
Loose
To be Agile
DevOps: Issues
Continuous Delivery
9
Company Deploy  Frequency Deploy  Lead  Time Reliability Customer  
Responsiveness
Amazon 23,000   /  day Minutes High High
Google 5,500   /  day Minutes High High
Netflix 500   /  day Minutes High High
Facebook 1  /  day Hours High High
Twitter 3  /  week Hours High High
Typical  enterprise Once   every  9  months Months   or  quarters Low  /  Medium Low  /  Medium
출처:  도서 The  Phoenix   Project
Amazon,
 Google,
 Netflix,
 Facebook,
 Twitter는얼마나자주 배포할까요?
Monolithic Architecture
à 모든 서비스가 한번에 재배포
à 한팀의 반영을 위하여 모든 팀이 대기
à 지속적 딜리버리가 어려워
Jeff Bezos Mandate
1. All teams will henceforth expose their data and functionality through
service interfaces.
2. Teams must communicate with each other through these interfaces.
3. There will be no other form of interprocess communication allowed: no
direct linking, no direct reads of another team's data store, no shared-
memory model, no back-doors whatsoever. The only communication
allowed is via service interface calls over the network.
…
4. The team must plan and design to be able to expose the interface to
developers in the outside world. No exceptions.
5. Anyone who doesn't do this will be fired.
11
Approach #1: Micro Service Architecture
Contract based, Polyglot Programming
à Separation of Concerns, Parallel Development, Easy Outsourcing
Written  in  Java
Written  in  Node
Written  in  PHP
Approach #2: Event Driven Architecture
Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­
systems-­with-­event-­storming-­73c6236f5dd7,  Kevin  webber
Monolith:
• With  Canonical  Model
• (“Rule  Them  All”  model)
Reactive  Microservices:
• Autonomously  designed  Model(Document)
• Polyglot  Persistence
E E
Approach #2: Event Driven Architecture
Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­with-­event-­
storming-­73c6236f5dd7,  Kevin  webber
프론트엔드
데이터베이스
재무 생산 인사
프론트엔드
데이
터베
이스
재무
데이
터베
이스
생산
데이
터베
이스
인사
모놀리씩 마이크로서비스
적용효과
효과 – 장애 최소화
프론트엔드
데이터베이스
재무 생산 인사
프론트엔드
데이
터베
이스
재무
데이
터베
이스
생산
데이
터베
이스
인사
장애가 전파되며, 수동 복구로 장애지연 장애가 격리되며, 자동으로복구됨(이전버전)
Java/J2EE
프론트엔드
데이터베이스
재무 생산 인사
프론트엔드
RDB
재무
(Java/
Tomc
at)
RDB
생산
(Java/
Spring)
RDB
인사
(.NET)
효과 – 기능 확장
수익
성
분석
스키
마
체인
지
No
SQL
수익
성
분석
(pytho
n)
기존 코드의 수정 à Big  Impact 신규 마이크로서비스의 추가 à Minimal  Impact
자율적 기술선택(플랫폼  데이터레이아웃)
Java/J2EE
프론트엔드
데이터베이스
재무 생산 인사
프론트엔드
RDB
재무
(Java/
Tomc
at)
생산
(Java/
Spring)
RDB
인사
(.NET)
효과 – 기능 확장
수익
성
분석
스키
마
체인
지
No
SQL
수익
성
분석
(pytho
n)
기존 코드의 수정 à Big  Impact 신규 마이크로서비스의 추가 à Minimal  Impact
자율적 기술선택(플랫폼  데이터레이아웃)
프론트엔드
데이터베이스
재무 생산 인사
프론트엔드
재무 생산 인사
효과 – 성능 배분
생산
계획
생산
계획
스케일업을 통해서만확장 수익성 분석의 워크로드에대한 스케일 아웃용이
생산 계획
Micro Service Architecture
▪변경된 서비스만 재배포
à Side effect 최소화
▪자율성
à 각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이
▪병렬 개발, 타임 투 마켓, 린 개발
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
Domain-Driven Design  MSA
▫ Bounded Context à 어떤 단위가 마이크로 서비스가 될 수 있는가?
▫ Context Mapping à 서비스를 결합 할 때는 어떻게 결합할 것인가?
▫ Domain Events à Event-driven Architecture 도출
DDD for MSA
Applicable Practices:
ㄱ. 이벤트 스토밍과 BPMN: 이벤트, 커맨드, 액터, 어그리게이트 식별
ㄴ. UML 과 컨텍스트 맵: 보편언어, 바운디드 컨텍스트 식별
23
DDD Pattern Applied
DDD: Domain Object Classifications
24
Classification Description Example
Domain
Event
▪ Captures  the  memory  of  something  
interesting  which  affects  the  domain
▪ I  go  to  Babur's  for  a  meal  on  Tuesday,  and  pay  
by  credit  card.  This  might  be  modeled  as  an  
event,  whose  event  type  is  'make  purchase',  
whose  subject  is  my  credit  card,  and  whose  
occurred  date  is  Tuesday.  If  Babur's  uses  an  
old  manual  system  and  doesn't  transmit  the  
transaction  until  Friday,  the  noticed  date  would  
be  Friday.
Entity and
Aggregate
▪ Objects that have a distinct identity that runs
through time and different representations.
▪ Usually big things like Customer, Ship, Rental
Agreement.
Service ▪ A standalone operation within the context of
your domain. A Service Object collects one or
more services into an object. Typically you
will have only one instance of each service
object type within your execution context.
▪ Services are usually accesses to external resources
like Database Connection, Messaging Gateway,
Repository, Product Factory.
Event Storming: DDD 를 쉽게하는 방법
▪이벤트스토밍은 시스템에서 발생하는 이벤트를 중심 (Event-First) 으로 분석하는 기법으로 특히 Non-blocking, Event-driven 한 MSA 기반 시스템을 분석에서
개발까지 필요한 도메인에 대한 탁월하게 빠른 이해를 도모하는데 유리하다.
▪기존의 유즈케이스나 클래스 다이어그래밍 방식은 고객 인터뷰나 엔티티 구조를 인지하는 방식과 다르게 별다른 사전 훈련된 지식과 도구 없이 진행할 수 있다.
▪진행과정은 참여자 워크숍 방식의 방법론으로 결과는 스티키 노트를 벽에 붙힌 것으로 결과가 남으며, 오랜지색 스티키 노트들의 연결로 비즈니스 프로세스가
도출되며 이들을 이후 BPMN과 UML 등으로 정재하여 전환할 수 있다.
vs.
What’s an Event?
An  Event  message  is  non-­prescriptive  of  what  should  happen  in  other
services.  
Events  always  carry  a  name  in  its  past-­tense  form:
OrderWasAccepted,  OrderHasShipped,  CustomerWasReimbursed
Other  qualities
• Immutable,  i.e.  content  cannot  be  changed
• Always  carries  the  ID  of  the  Business  Object  it  relates  to
• An  event  can  and  will  typically  will  be  published  to  multiple
consumers.
– The  publisher   of  the  event  does  not  know  who  the  recipients  are
Event Flows: Timeline-based
Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­
with-­event-­storming-­73c6236f5dd7,  Kevin  webber
Policy: Reactions triggered by Event
“Whenever a new user account is createdwe will send her an acknowledgement
by email”.
Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­
with-­event-­storming-­73c6236f5dd7,  Kevin  webber
Decomposing Mi-Svc
: Finding Aggregate
Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­
with-­event-­storming-­73c6236f5dd7,  Kevin  webber
Decomposing Mi-Svc
: Bounded Contexts
Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­
with-­event-­storming-­73c6236f5dd7,  Kevin  webber
Lab Time – Event 들을 먼저 도출
상품등록됨 상품재고
변경됨
상품삭제됨
주문생성됨 주문정보
변경됨
주문취소됨
배송출발함
배송취소
요청됨
우리 서비스에는 어떤 비즈니스이벤트들이 발생하는가?
현업이 사용하는 용어를 그대로사용 (Ubiquitous  Language)
용어의 namespace  를 구지 나누려는노력을하지 않음
상품정보
변경됨
주문상태
변경됨
배송준비됨
배송완료됨
Lab Time – Policy 도출
어떤 이벤트에 이어서 곧바로 항상 발생해야하는 업무규칙
구현상에서는 이벤트의 Publish에 따라 벌어지는 이후의프로세스가자동으로트리거 되게 함
상품등록됨 상품재고
변경됨
주문생성됨 주문정보
변경됨
배송출발함배송준비됨
홍보
메일발송
입고
메일발송
배송생성
배송정보
변경
배송지시
알림메일
발송
상품삭제됨 주문취소됨 배송취소
요청됨
상품정보
변경됨
주문상태
변경됨
배송완료됨
배송취소
알림메일
발송
회수지시
재고변경 재고변경
재고변경
주문취소
수신
완료수신
출발수신주문생성
수신
주문취소주문취소
정보변경결제클릭
재고변경
Lab Time – Command 도출 (쓰기행위)
Event를 발생시키는 명령은무엇인가? UI를 통해?  or  시간도래? or  다른 이벤트에 의해?
Command  는 어떠한 상태의 변화를 일으키는서비스를 말함.
*  Command 라는 용어는 CQRS  에서 유래했으며, 쓰기서비스인Command  와 읽기행위인Query는구분됨.
상품재고
변경됨
주문생성됨 주문정보
변경됨 배송출발함
배송준비됨
입고
메일발송
배송생성
배송정보
변경 배송지시
알림메일
발송
상품등록
상품등록됨
상품삭제정보변경
상품삭제됨 주문취소됨
배송취소
요청됨
상품정보
변경됨
주문상태
변경됨
배송완료됨
배송취소 알림메일
발송 회수지시
홍보
메일발송
재고변경 재고변경
재고변경
주문취소
수신
완료수신
출발수신주문생성
수신
주문취소주문취소
정보변경결제클릭
재고변경
Lab Time – Command Actor 식별
Actor  는 Command를 발생시키는주체
담당자 또는 시스템 (외부 (External)  또는 내부)이될 수 있음
상품재고
변경됨 주문생성됨 주문정보
변경됨
배송출발함
배송준비됨
입고
메일발송
배송준비
배송정보
변경
배송지시
알림메일
발송
상품등록
상품등록됨
상품삭제정보변경
상품삭제됨
주문취소됨
배송취소
요청됨
상품정보
변경됨
주문상태
변경됨
배송완료됨
배송취소
알림메일
발송 회수지시
홍보
메일발송
MD
MD
MD
사용자
사용자
사용자
사용자
시스템
시스템
시스템
시스템
MD
재고변경 재고변경
재고변경
Lab Time – Aggregate 도출 (데이터모델)
도메인 이벤트가 발생하는데는, 어떠한 도메인 객체의변화가 발생했기 때문이다.
하나의 ACID  한 트랜잭션에 묶여 변화되어야 할 객체의묶음을 도출하고,그것들을커맨드, 이벤트와함께 묶는다.
주문취소
수신
완료수신
출발수신
주문생성
수신
주문취소
주문취소
정보변경
결제클릭
재고변경 상품재고
변경됨
주문생성됨
주문정보
변경됨
배송출발함
배송준비됨
입고
메일발송
배송생성
배송정보
변경
배송지시
알림메일
발송
상품등록 상품등록됨
상품삭제
정보변경
상품삭제됨
주문취소됨
배송취소
요청됨
상품정보
변경됨
주문상태
변경됨
배송완료됨
배송취소
알림메일
발송
회수지시
홍보
메일발송
상품
(Product)
주문
(Order)
배송
(Delivery)
MD
MD
MD
MD
사용자
사용자
사용자
사용자
시스템
시스템
시스템
시스템
재고변경
재고변경
재고변경
Lab Time – Bounded Context 도출
개념적:
• Bounded  Context  는 동일한 문맥으로 효율적으로 업무 용어 (도메인 클래스)를 사용할 수 있는 객체범위를 뜻한다. 하나의 BC  는 하나이상의 어그리게잇을
원소로 구성될 수 있다. BC를 Microservice 구성단위로 정하게 되면 이를 담당한 팀 내의 커뮤니케이션이 효율화된다.
구현관점:
• 어그리게잇은 ACID  트랜잭션 범위이기도 하기때문에 이를 더 쪼개서 BC  를 구성할 수는 없다. BC  내의 어그리게잇들에 대한 보존 (Persistence)은 아마도 그
목적에 맞는 최적화된 데이터모델을 독립적으로 설계하고 구현할 수 있다.
주문취소
수신
완료수신
출발수신
주문생성
수신
주문취소
주문취소
정보변경
결제클릭
재고변경 상품재고
변경됨
주문생성됨
주문정보
변경됨
배송출발함
배송준비됨
입고
메일발송
배송생성
배송정보
변경
배송지시
알림메일
발송
상품등록 상품등록됨
상품삭제
정보변경
상품삭제됨
주문취소됨
배송취소
요청됨
상품정보
변경됨
주문상태
변경됨
배송완료됨
배송취소
알림메일
발송
회수지시
홍보
메일발송
상품
(Product)
주문
(Order)
배송
(Delivery)
MD
MD
MD
MD
사용자
사용자
사용자
사용자
시스템
시스템
시스템
시스템
상품관리 주문관리 배송관리
재고변경
재고변경
재고변경
12번가 Shopping Mall Bounded Context
주문취소
수신
완료수신
출발수신
주문생성
수신
배송출발함
배송준비됨
배송지시
알림메일
발송
배송취소
요청됨
배송완료됨
알림메일
발송
회수지시
배송
(Delivery)
시스템
시스템
시스템
시스템
재고변경 상품재고
변경됨
입고
메일발송
상품등록 상품등록됨
상품삭제
정보변경
상품삭제됨
상품정보
변경됨
홍보
메일발송
상품
(Product)
MD
MD
MD
MD
상품관리
배송관리
반품요청
접수
반품접수됨
접수메일
발송
반품
(Return)
담당자
고객센터
상품회수
요청
컴플레인
등록
컴플레인
등록됨
주문자
답변등록 답변등록됨
담당자
등록메일
발송
등록메일
발송
컴플레인
(Complain)
VIP회원
등록
VIP등록됨
등록메일
발송
담당자
VIP회원
삭제
VIP해제됨
해제메일
발송
담당자
VIP
(VIP)
주문취소
주문취소
정보변경
결제클릭 주문생성됨
주문정보
변경됨
배송생성
배송정보
변경
주문취소됨
주문상태
변경됨
배송취소
주문
(Order)
사용자
사용자
사용자
사용자
주문관리
재고변경
재고변경
재고변경
설문제출 설문응답등
록됨
등록
메일발송
설문등록 설문등록됨
설문진행
메일발송
설문조사
(Survey)
담당자
사용자
마케팅관리
캠페인
삭제
캠페인
삭제됨
캠페인등
록
캠페인
등록됨
캠페인
메일발송캠페인
(Campaign)
담당자
담당자
주문정보
조회
주문생성
수신
시스템
메일
로그
주문이력
추가됨
주문
이력 AI분석
요청지시
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
Microservice Implementation Pattern (1)
▪Hexagonal Architecture
▫Create your service to be independent of
either UI or database and to provide adapters
for different input/output sources such as
GUI, DB, test harness, RESTful resource,
etc.
▫Implement the publish-and-subscribe
messaging pattern: As events arrive at a port,
an adapter (a.k.a. service agent) converts it
into a procedure call or message and passes it
to the application. When the application has
something to publish, it does it through a port
to an adapter, which creates the appropriate
signals needed by the receiver.
(https://alistair.cockburn.us/Hexagonal+archi
tecture)
39
비즈니스 로직
Message
consumer
Message
producer
DAO
Some
Controller
class
Browser
Message  broker
Foo
service
Domain  
Event
Repository
interface
Inbound  port
Inbound  adapter Inbound  adapter
Outbound  port
Outbound  port
Database
Outbound  adapter
40
▪HATEOAS (Hypertext As The
Engine Of Application State)
▫HATEOAS is deemed the highest maturity level
of REST.
(https://martinfowler.com/articles/richardsonMatu
rityModel.html)
▫In the HATEOAS architecture, a client enters a
REST application through a specific URL, and all
future actions the client may take are discovered
within resource representations returned from the
server.
▫This self-contained discoverability can be a
drawback for most service consumers who prefer
API documentation.
Microservice Implementation Pattern (2)
Service Implementation
▪ You have Powerful Tool:
Domain-Driven Design and Spring Boot / Spring Data REST
▪ Domain Classes : Entity or Value Object
▪ Resources can be bound to Repositories à Full HATEOAS service can be generated!
▪ Services can be implemented with Resource model firstly
▪ Low-level JAX-RS can be used if not applicable above
41
Step 1: Applying Hexagonal Architecture
주문정보
입력
주문이
발생함
주문
(Order)
  domain  model
주문
주문 (Order)
Message
consumer
Message
producer
DAO
ControllerBrowser
Message  broker
과정정보
입력
주문이
발생함
Repository
interface
커맨드
외부
도메인이벤트
도메인이벤트
Database
Step 2: Applying MSA Chassis
  MSA  chassis  
Spring  Boot  /  Cloud
주문(Order)
Message
consumer
Message
producer
DAO
ControllerBrowser
Message  broker
과정정보
입력
주문이
발생함
Repository
interface
Spring  Data  REST
외부
도메인이벤트
도메인이벤트
Database
JPA
Spring  
Data  
Rest
Spring  Cloud  Stream
JPA
Spring  Data  Rest
Spring  Boot
Spring Boot: A MSA Chassis
44
• Simple  Java  (POJO)
• Minimal  Understanding  Of  Frameworks  and  Platforms
(Using  Annotations)
• No  Server-­side  GUI  rendering  
(Only  Exposes  REST  Service)
• No  WAS  deployment  required
(Code  is  server;;  Tomcat  embedded)
• No  XML-­based  Configuration
Main  Application
Domain  Classes
Services  and  Repositories
Settings
Lab: Create a Spring boot application
45
Go  to  start.spring.io
Set  metadata:
-­ Group:  com.example
-­ Artifact:  12st-­mall
-­ Dependencies:
§ H2
§ Rest  Repositories
§ JPA
Press  “Generate  Project”
Extract  the  downloaded  zip  file
Build  the  project:
./mvnw spring-­boot:run
Port  충돌시:
./mvnw spring-­boot:run -­Dserver.port=8081
Running Spring Boot Application
46
$ mvn spring-boot:run # 혹은 ./mvnw spring-boot:run
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ….
[INFO] ------------------------------------------------------------------------
[INFO] Downloading:
https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-
core/maven-metadata.xml
[INFO] Downloading:
https://oss.sonatype.org/content/repositories/snapshots/org/springframework/security/spring
-security-core/maven-metadata.xml
[INFO] Downloading: https://repo.spring.io/libs-release
:
Started  Application  in  11.691  seconds  (JVM  running  for  14.505)
Source code:
$ git clone https://github.com/uengine-oss/software-modeling-class-management-monolith.git
Test Generated Services
47
$ http localhost:8080
HATEOAS  links
HTTP/1.1 200
Content-Type: application/hal+json;charset=UTF-8
Date: Wed, 05 Dec 2018 04:20:52 GMT
Transfer-Encoding: chunked
{
_links: {
profile: {
href: http://localhost:8080/profile
}
}
}
HTTP  =  success
Aggregate à Entity Class 작성
상품 주문 배송
@Entity
public  class  Order  {
@Id
@GeneratedValue
private  Long  id;;
private  Long  productId;;
private  String  productName;;
private  int quantity;;
private  int price;;
private  String  customerName;;
private  String  customerAddr;;
@ManyToOne
@JoinColumn(name=”productId)
Product  product;;
}
@Entity
public  class  Product  {
@Id
@GeneratedValue
private  Long  id;;
String  name;;
int price;;
int stock;;
@OneToMany(  cascade  =  
CascadeType.ALL,  fetch  =  FetchType.EAGER,  
mappedBy =  ”order)
ListOrde  orders;;
}
@Entity
public  class  Delivery  {
@Id  @GeneratedValue
private  Long  deliveryId;;
private  Long  orderId;;
private  String  customerName;;
private  String  deliveryAddress;;
private  String  deliveryState;;
@OneToOne
Order  order;;
}
Commands à Service Object* 와 API의 생성
Repository  Pattern  으로 생성된것 사용할 수
있는 경우
주문과 배송 API  는 Order  Repository  에서
생성된 CRUD  actions  들 중 POST  Service  
를 그대로 사용할 수 있으므로 별도 구현할
필요 없다. 마찬가지 주문서 수정, 삭제도
각각 PATCH,  DELETE  로 API  생성
전체의 약 7~80% 커버
Repository  에서 생성된 API  를 사용 못하는 경우, 별도
Spring  MVC  Service  로 생성
배송일정 등을 위한 백엔드 API  는 Order  Repository  에
생성된 PUT-­POST-­PATCH-­DELETE  중 적합한 것이
없으므로 별도 추가 action  URI를 만드는 것이 적합
나머지 2~30% 수준
@Service
public  interface   ProductService {
@RequestMapping(method   =  RequestMethod.GET,   path=/calendar/{deliveryId}/{date})
Resources   getProduct(@PathVariabl e(”deliveryId)   Long   deliveryId,   @PathVariable(date)
String  date);;
}
public  interface   OrderRepository extends  PagingAndSortingR epositoryCourse,   Long   {
ListCourse  findByOrderId(@Param(”orderId)   Long   OrderId);;
}
상품정보
C.R.U.D
주문정보
C.R.U.D
배송정보
변경배송정보
C.R.U.D
재고변경컴플레인
….  등등등
배송지시 배송알림
발송
Main Class
50
@SpringBootApplication
public  class  Application
public  static  void  main(String[]  args)  {
SpringApplication.run(Application.class,  args);;
}
}
Test Generated Services
51
$ http localhost:8081
{
_links: {
”products: {
href: http://localhost:8081/products{?page,size,sort},
templated: true
}
}
$ http localhost:8082
{
{_links: {
”orders: {
href: http://localhost:8082/orders{?page,size,sort},
templated: true
}
}
$ http localhost:8083
{
{_links: {
”deliverys: {
href: http://localhost:8083/deliverys{?page,size,sort},
templated: true
} }
}
HATEOAS  links
Create new Order
52
$ http localhost:8082/orders productId=1 productName=TV quantity=1
customerName=홍길동 customerAddr=서울시
{
        _links:  {
        order:  {
                href:  http://localhost:8082/orders/1
        },
        self:  {
                href:  http://localhost:8082/orders/1
        }
},
        customerAddr:  서울시,
                customerName:  홍길동,
                price:  0,
                productId:  1,
                productName:  TV,
                quantity:  1
}
URI  of  the  new  order
Create a delivery of the order
53
$ http POST localhost:8083/deliverys deliveryState =“DeliveryStarted”
orderId =http://localhost:8082/orders/1
$ http http://localhost:8083/deliverys/1/order
URI  of  the  SOA  
delivery
{
        _links:  {
         self:  {
                href:  http://localhost:8082/orders/1
         }
},
        customerAddr:  서울시,
                customerName:  홍길동,
                price:  0,
                productId:  1,
                productName:  TV,
                quantity:  1
}
Delivery  is  aggregation  root
Monolothic 에서의 분산 트랜잭션 – 이슈없음
주문량: 0 재고량: 10
주문량: 1 재고량: 9
Consistent
In-­consistent
조회화면
서비스구성 (모놀로씩)
Order
(MySQL)
Client  (Web/Mobile)
POST
Order Product
주문량: 2 재고량: 8
Nice but Too big (monolith)
55
JPA
HATEOAS   API
/orders/*
/products/*
/deliverys/*
Service   Object
Generated   by  Spring
Repositories:
OrderRepository
DeliveryRepository
ProductRepository
H2
Entity
Order
Entity
Product
Entity
Delivery
Entity
New   Service
Entity
New   Service
Entity
YetAnother…
….
Plan  to  add…
Requirements / Check
Category Requirement Solution
Maintainability  
  Scalability
24*365 Zero  Down  time Self-­Healing,  Horizontally  Scale
Minimal  Dev-­Ops,  Dev-­Dev  team  side  
effects  in  deploy  time
(more  than  100  deploys  per  day)
Loose  coupled  design  (HATEOAS  API,  
Service  Decomposition),  PubSub
Auto  Provisioning (by  docker
containerizing)
DevOps  CI/CD
Scalability  
Reusability
Multi-­channel  Support Responsive  Web, Chat  Bot
Dynamic Service  Composition Dynamic  Discovery/Composition, BPM
Usability    
Performance
Fast  browsing,  Single  Page, DDoS
protection,  Inter-­microservice integration
Client-­side  UI  rendering,  API  Gateway,  
Circuit Breaker,  Event-­driven  Arch.
Security For  all services including  3rd-­party  ACL Access  Token,  IAM
56
HATEOAS  API
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
“
▪From Monolith to Microservices
58
https://github.com/jinyoung/software-­modeling-­class-­management-­monolith
à
https://github.com/jinyoung/software-­modeling-­class-­management-­msa
DDD Pattern Applied
59
Lab Time – 마이크로서비스 도출
• 마케팅 관리와 고객센터 팀 내에는 서로 간의 간섭이 전혀 없는 복수 개의 어그리게잇으로 구성되어 있어 더 작은 마이크로서비스로 충분히 도출 가능함.
60
Lab Time – Context Map 도출
개념적:
• BC  간의 정보참조의 릴레이션, 혹은 이벤트가 발생한 이후의 동반된 행위의 호출의 관계를 선으로 표시함. Upstream  à Downstream  으로 정보가 내려가게 됨.
구현관점:
• 자치적으로 구현설계가 이루어질 수 있는 BC  간에 커뮤니케이션을 위해서는 데이터의 적절한 변환이나 표준화, Pub/Sub  등의 커뮤니케이션 방법 및 데이터
전환에 대한 이슈가 발생하게 됨. 해당 이슈를 적절한 패턴을 선택하여 실제 연동을 위한 Adapter  를 개발해야 함.61
Lab Time – Topology Consideration
라이락 스티커 (Policy)  를 어디에 둘 것인가?
-­ Orchestration  or  Choreography?  Or  Mediation?
Orchestration Choreography
More  autonomy  to  handle  the  policy
à Low-­Coupling
à Easy  to  add  new  policies
Originator  should  know  how  to  handle  the  policy
à Coupling  is  High
62
Ref: Relation types between services
63
Eric  Evans,  Domain-­Driven  Design,  2003.
▪Shared Kernel
▫Designate a subset of the domain model that the two teams agree to share.
▪Customer/Supplier
▫Make the downstream team play the customerrole to the upstreamteam.
▪Conformist
▫Eliminate the complexity of translationbetween boundedcontexts by slavishly adheringto
the model of the upstream team.
▪Separate Ways
▫Declare a boundedcontext to have no connection to the others at all. The features can still
be organized in middleware or the UI layer.
▪Open Host Service
▫Open the protocol so that all who need to integrate with you can use it. Other teams are
forced to learn the particular dialect usedby the host team. In some situations, using a well-
known publishedlanguage as the interchange model can reduce coupling and ease
understanding.
Issues in transforming Monolith to
Microservices
Order
(Mongo  DB)
Marketing
(File  Sys)
Product
(H2)
Delivery
(RDB)
Service-­Center
(External)
강사
스케쥴
확인
(REST)
Sub
강의 일정 발생
(Pub)
MQ  (Kafka)
광고
메일
발송
(Sub)JPA
Service  Object
Generated  by  
Spring
Repositories:
Cour seReposit or y
ClazzReposit or y
I nst r uct or Reposit or y
H2
Ent it y
Course
Ent it y
Clazz
Ent it y
Instructor
Ent it y
Schedule
Ent it y
Notificati
on
Ent it y
Enrollme
nt
….
?
Ent it y
Detail
Ent it y
Product Ent it y
Delivery
Ent it y
…
Ent it y
…
Ent it y
Detail
Ent it y
YetAnother…
REST  API
REST  API
API  Gateway
강 결합된 객체
참조 구조
Ent it y
Order
Solutions – 객체의 분리
65
• 참조해야 할 도메인 클래스들의 공통화
à Shared  Kernel,  Maven  Repo  등을 통한 공통 모델의 공유
: 동일 언어인 경우 유리, 디펜던시 발생
à 혹은 중복 모델 개발 : Polyglot  인 경우 유리
• Entity  분리에 따른 원격 객체 (어그리게잇) 참조
à Primary  Key  를 통해서만 참조
à HATEOAS  link  를 이용
Solutions – API 통합
66
• API  Gateway  
à 진입점의 통일
à Path-­based  Routing  (기존에 REST  로 된경우 가능)
• Service  Registry
à API  Gateway  가 클러스터 내의 인스턴스를 찾아가는 맵
Solutions – 이벤트의 퍼블리시
67
• Aggregate  내 코드 주입
à 호출 코드 직접 주입, Hexagonal  
Architecture  의 손상
à JPA  의 Lifecycle  Annotation  사용
• CDC  (Change  Data  Capturing)  기능
사용
à DB  의 Change  Log  를 Listening,  Event  
자동퍼블리시 하는 툴
à Debezium,  Eventuate  Tram  등이 존재
레가시
시스템 New   서비스
Event
pulisher
Event handler
Translation layer
Messaging client
Order
event
Event  channel
Anti-­corruption   layer
Ubiquitous   language   of  service
Ubiquitous   language   of  monolith
Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
Legacy Transformation – Strangler Pattern
68
Strangler  application
Service Service
Service
Service
Service
Service
Service
… Service
Service
Service
Service
Service
Service
Service
Service
Service
Service
Service
Service
Service
Service
Service
Time
Monolith
Monolith
Monolith Monolith
… Monolith
The   Monolith   shrinks  over  time.
The   strangler  application
Grows  larger  over  time.
• Strangler 패턴으로 레가시의
모노리스 서비스가
마이크로서비스로 점진적
대체를 통한 Biz 임팩트
최소화를 통한 구조적 변화
• 기존에서 분리된 서비스
영역이 기존 모노리스와 연동
될 수 있도록 해주는 것이
필요.
• 그 방법은 앞서 동기/ 비동기
방식이 채용될 수 있음
• 동기 – 레거시로 하여금 기존
소스코드 수정 요인이 높음,
따라서 이벤트 기반 비동기
연동 (CQRS) 추천
Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
마이크로 서비스간의 서열과 역학관계
69
1순위: Core  Domain
버릴 수 없는. 이 기능이 제공되지 않으면 회사가 망하는.
예) 쇼핑몰 시스템에서 주문, 카탈로그 서비스 등
2순위: Supportive  Domain
기업의 핵심 경쟁력이 아닌, 직접 운영해도 좋지만 상황에 따라
아웃소싱 가능한. 시스템 리소스가 모자라면 외부서비스를
빌려쓰는 것을 고려할만한
예) 재고관리, 배송, 회원관리 서비스 등
3순위: General  Domain
SaaS  등을 사용하는게 더 저렴한, 기업 경쟁력과는 완전 무관한
예) 결재, 빌링 서비스 등
무엇을 우선적으로 챙길 것인가?
마이크로 서비스간의 서열과 역학관계
70
어느 마이크로 서비스의 인터페이스를 더 중요하게 관리할 것인가?
카탈로그
(core)
배송 SaaS
(general,  외부서비스)
상품추천
(supportive)
Core  Domain  간 (높은 서열끼리) 에는 Shared-­kernel  도 허용가능하다. 하지만, 중요도가
낮은 서비스를 위해 높은서열의 서비스가 인터페이스를 맞추는 경우는 없을 것이다.
conformist
Anti-­corruption
주문
(core)
Shared-­kernel
마이크로 서비스간의 서열과 역학관계
71
마이크로서비스간 트랜잭션의 묶음을 어떻게 할 것인가?
재고
(core)
배송
상품추천
(supportive)
배송기사가 없다고 주문을 안받을 것인가?
상품 추천이 안된다고 주문버튼을 안보여줄 것인가?
Core  Domain  간에는 강결합이 요구되는 경우가 생길 수 있다. 하지만 우선순위가 떨어지는 비즈니스
기능을 위해 강한 트랜잭션을 연결할 이유는 하등에 없다.
UI  mashup
Async
Event-­driven
Eventual  TX
주문
(core)
ACID  TX
(2PC)
마이크로 서비스간의 서열과 역학관계
72
손님이 많이 와서 집이 좁아졌다.. 무엇을 우선적으로 줄일 것인가?
주문 주문 배송
배송
상품
추천
주문 주문 주문
주문
상품
추천
배송서비스는 야간에 올라와서 후에 처리되어도 된다.
주문이 몰려드는 시간에 주문을 못받으면 배송은 의미가 없다
Requirements / Check
Category Requirement Solution
Maintainability  
  Scalability
24*365 Zero  Down  time Self-­Healing,  Horizontally  Scale
Minimal  Dev-­Ops,  Dev-­Dev  team  side  
effects  in  deploy  time
(more  than  100  deploys  per  day)
Loose  coupled  design  (HATEOAS  API,  
Service  Decomposition),  PubSub
Auto  Provisioning (by  docker
containerizing)
DevOps  CI/CD
Scalability  
Reusability
Multi-­channel  Support Responsive  Web, Chat  Bot
Dynamic Service  Composition Dynamic  Discovery/Composition, BPM
Usability    
Performance
Fast  browsing,  Single  Page, DDoS
protection,  Inter-­microservice integration
Client-­side  UI  rendering,  API  Gateway,  
Circuit Breaker,  Event-­driven  Arch.
Security For  all services including  3rd-­party  ACL Access  Token,  IAM
73
Loose  coupled  design  (HATEOAS  API,  
Service  Decomposition)
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
Integration Patterns
75
By Request-Response
By Event-driven
Architecture
By UI
“
76
Service Composition
with User Interface
▪ Extended Role of Front-end in MSA Architecture: Service
Aggregation
▪ Why MVVM?
▪ W3C Web Components Standard – Domain HTML Tags
▪ Implementation: Polymer and VueJS
▪ Another: ReactJS and Angular2
▪ Micro-service Mashups with Domain Tags: i.e. IBM bluetags
▪ Cross-Origin Resource Sharing
▪ API Gateway (Netflix Zuul)
https://www.youtube.com/watch?v=djQh8XKRzRg
https://github.com/IBM-­Cloud/bluetag
아마존 닷컴은 다양한 서비스 제공과 효율적인 운영 환경 전환을 위해 분산 서비스 플랫폼으로 전환
하였습니다.
2001년 아마존은 주요한 아키텍쳐 변화가 있었는데
기존 모놀리식(Monolitic)
 기반에서
서로 다른 어플리케이션 기능을 제공하는
분산 서비스 플랫폼으로 변화 하였습니다.
현재의 Amazon.com의 첫 화면에 들어 온다면,
 
그 페이지를 생성하기 위해
100여개가 넘는 서비스를 호출하여 만들고 있습니다.
Client-side Rendering : 장애 전파 회피
상품이미지
[주문버튼]
배너
상품추천
다음중 가능한 빨리 로딩되어야 하고, 문제가 없어야 할 화면 영역은?
Server-­side  Rendering  은 모든 화면의 콘텐츠가 도달해야만 화면을 보여줄 수 있지만, Client-­
side  Rendering  은 먼저 데이터가 도달한 화면부터 우선적으로 표출할 수 있다.
광고배너가 나가지 못한다고 주문을 안받을 것인가?
그걸 원하지 않는다면 AJAX  /  MVVM  같은 Client-­side  Rendering  기술에 주목하자
1 2
3
Microservice Integration with by UI
▪서비스의 통합을 위하여 기존에
Join SQL 등을 사용하지 않고
프론트-엔드 기술이나 API
Gateway 를통하여서비스 간
데이터를 통합함
▪프론트엔드에서 데이터를 통합하기
위한 접근 방법으로는 W3C 의
Web Components 기법과 MVVM
그리고 RESTAPI 전용 스크립트가
유용함
W3C Web Components
80
style
style  for  A
style  for  B
style  for  C
/style
html
element  for  A
element  for  B
element  for  C
/html
script
script  for  A
script  for  B
script  for  C
/script
#A.html
style
style  for  A
/style
html
element  for  A
/html
script
script  for  A
/script
#B.html
style
style  for  B
/style
html
element  for  B
/html
script
script  for  B
/script
#C.html
style
style  for  C
/style
html
element  for  C
/html
script
script  for  C
/script
#index.html
A  A
B  B  B
C  
▪ Custom elements
▪ HTML imports
▪ Template
▪ Shadow DOM
MVVM
81
Frameworks supporting Web Components
82
• Provides  Cohesive  Component   Model
• Component   Composition   by  HTML  
markup
• Dynamic  Data  Binding
• Responsive  Web  by  Material   Design
• Standard
Polymer                             VueJS
**  비표준: Angular  JS,  React
Custom tag for Domain Class: product tag
83
template
div
h1Product  Management/h1
product  v-­model=”products[index]  v-­for='(product,  index)  in  products'  
@change=updateProduct  @remove=removeProduct  
@classes=jumpToProducts/product
h2Add  New  Product/h2
product  v-­model=newProduct  editMode=true  isNew=true  
@add=addProduct/product
/div
/template
Data binding to Domain Class Tags
84
script
var products  =  [];;
var me  =  this;;
backend.$bind(”products,  products  );;
products.$load().then(function(products  ){
me.  products  =  products  ;;  //  set  the  view's  data  with  the  loaded  data  obtained  from  backend.
});;
/script
product  v-­model=”products[index]  v-­for='(product,  index)  in  products'  
@change=updateProduct  @remove=removeProduct  
@classes=jumpToProducts/product
Tenant UI Customization (Composition) by
Tag composition
85
Domain  HTML  Tags
product
order  
delivery
customer
….  
Tenant  A
Tenant  B
Tenant  C
86
Oops! CORS Exception?
Accessing  Multiple  
Microservices from  
outside
87
API Gateway: Edge Service
Acting  like  “Skin”  to  access  our  services  :
• Re-­Routes  to  multiple  services
• Allows  CORS
• Checks  ACLs
• Prevent  DDOS  etc.
API Gateway:
Routing, Securing and Load-balancing
88
Front-­‐End
API	
  GW	
  (Spring	
  Gateway)
Product Delivery1Order1
EUREKA
/
Kube-­‐DNS
http://abc.com/orders/** http://abc.com/products/** http://abc.com/deliveries/**
Order-­service:  ip1,  ip2
Product-­service:  ip3
Delivery-­service:  ip4,  ip5
Order2 Delivery	
  2
Ip1:port1/orders/** Ip2:port2/orders/**
Ip3:port3-­1/products/**
Ip4:port4-­1/deliveries/**
Ip5:port5-­1/deliveries/**
• Add  CORS  Header
• Routes  to  actual  backend  service  
• Load  Balancing
• Fallback
Delivery	
  3 Ip6:port6-­1/deliveries/**
By  container  orchestrator  something
89
Configuring Spring Gateway
#application.yml
spring:
    cloud:
        gateway:
            routes:
                -­  id:  product
                    uri:  http://product:8080
                    predicates:
                        -­  Path=/product/**
                -­  id:  order
                    uri:  http://order:8080
                    predicates:
                        -­  Path=/order/**
                -­  id:  delivery
                    uri:  http://delivery:8080
                    predicates:
                        -­  Path=/deliveries/**
Service Registration: EUREKA or Kube-DNS
90
91
OAuth2 Authorization Server implemented
by Spring Security
• https://github.com/Baeldung/spring-­security-­oauth
• https://www.keycloak.org/
• https://github.com/TheOpenCloudEngine/uEngine-­cloud/tree/master/uengine-­cloud-­iam
Transaction Problem in UI composition
주문량: 0 재고량: 10
주문량 : 1 재고량 : 10
주문량 : 2 재고량 : 9
주문량 : 3 재고량 : 8
Consistent
In-­consistent
조회화면서비스구성 (클라이언트가 순차 호출)
Product
(MongoDB)
Order
(MySQL)
Client  (Web/Mobile)
POST (성공시) -­à POST
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
“
94
Service Composition by
Request-Reponse
▪ Inter-microservices call requires client-side discovery
and load-balancing
▪ Netflix Ribbon and Eureka
▪ Hiding the transportation layer:
Spring Feign library and JAX-RS
▪ Circuit Breaker Patterns
서비스의 호출 방식 2가지
▪ 외부에서
95
마이크로 서비스 간
(inter-­microservice call)
HTTPClient 로 REST 호출 혹은 Event  로 pub/sub
Feign  을 사용, @Autowired 로 proxy  객체리턴 혹은
MOM  (Apache  Kafka),  Spring  Cloud  Stream
Ribbon  이 Eureka  를 통하여 직접 마이크로
서비스가 로드밸런싱된 대상을 선택
AJAX  로 REST 호출
Hybind 를 사용, 자바스크립트객체와
Resource  바인딩
Zuul을 경유하여 Eureka  에서 발견된
path  에 따른 서비스가 라우팅
Inter-microservices Call – Request/Response
96
Front-­‐end
API	
  GW	
  (ZUUL)
Product Order
Course
EUREKA
/
Kube-­‐DNS
Course:  ip1,  ip2
Clazz:  ip3
ScheduleCalendar:  ip4,  ip5
Ribbon	
  /
Envoy	
  
sidecar
Zuul을 경유하지 않고 직접 내부 IP  
로 접근
getStock()
FeignClient
97
-­-­-­-­ url을 기반으로 Kube-­
DNS  를 찾아감
@FeignClient(name  =  ”product”,  url=“http://product:8080”)
public  interface  ProductService {
@RequestMapping(method   =  RequestMethod.GET,  path=/products/{productId})
Product  getProduct(@PathVariable(”productId)  Long  productId);;
}
Consumer Code: Order
98
@Entity
public  class  Order{
@Autowired
ProductService ProductService;;
@PrePersist
public  void  beforeSave()  {
Product  product  =  ProductService.getProduct(getProductId());;
if(product.getStock()    getQty()){
throw  new  RuntimeException(”No  Available  stock!  );;
}
}
}
Issues in Request-Response model
서비스구성 (Request-­Response,  Sync  호출)
Product
(MongoDB)
Order
(MySQL)
Client  (Web/Mobile)
POST
POST Yet  Another  SVC
(NoSQL)
POST
• 성능저하
• 장애전파
• 트랜잭션 처리를 위한 2PC  구현
장애전파 차단: 서킷브레이커 패턴
100
Client
Circuit
breaker Supplier
Connection
problem
timeouttimeout
timeouttimeout
trip
Circuit  open
장애 감지 시, 차단기 작동(Open)
일시 동안 Fallback으로 서비스 대체
일부 트래픽으로 서비스 정상여부 확인
정상 확인 시, 차단기 해제(Close)
“
101
Service Composition by Event-driven
Model
▪ Event-driven Approach
▪ ACID Tx. vs Eventual Tx.
▪ Business Transaction / Compensation (Saga) Pattern
Microservice Integration with
Event-driven Architecture
102
Vs.
Inter-microservice Call - Event Publish / Subscribe (PubSub)
103
Order Delivery Product
pub sub
Event  Queue  (i.e.  Apache  Kafka)
sub주문이 발생함, TV,  
홍길동
배송처리완료배송처리함
pub
sub
재고수량처리함 상품정보변경됨
pub
Event Publisher : Order
104
@Entity
public  class  Order  {
…  
@PostPersist
private  void  publishOrderPlaced()  {
OrderPlaced orderPlaced =  new  OrderPlaced();;
orderPlaced.setOrderId(id);;
…
kafka.send(orderPlaced);;
}
}
Event Consumer: Delivery
105
@KafkaListener(topics  =  ”shopping)
public  void  onOrderPlaced(…)  {
Delivery  delivery  =  new  Delivery();;
delivery.setOrderId(orderPlaced.getOrderId());;
delivery.setDeliveryAddress(orderPlaced.getCustomerAddr());;
delivery.setCustomerName(orderPlaced.getCustomerName());;
delivery.setDeliveryState(DeliveryStarted.class.getSimpleName());;
deliveryRepository.save(delivery);;
Kafka.send(new  OrderShippped(delivery));;    //triggers  new  event
}
Event Consumer: Product
106
@KafkaListener(topics  =  ”shopping)
public  void  onOrderShipped(…)  {
Product  product  =  productRepository.findById(orderShipped.getProductId());;
product.setStock(product.getStock()   – 1);;
productRepository.save(product);;
}
Adding a new service
107
Order Delivery Marketing
pub sub
Event  Queue  (i.e.  Apache  Kafka)
sub주문이
발생함, TV,  
홍길동
배송처리완
료
배송처리함
pub
sub
홍길동의
선호도 정보
수집함
Product
sub
sub
재고수량처
리함
상품정보변
경됨
pub
New  Service
Distributed Transaction Issues
108
Eventual  Transaction  /  compensationAtomic  Transaction  /  2PC
Eventual TX를 통한 분산 트랜잭션 처리
주문량: 0 재고량: 10
주문량: 1 재고량: 10
주문량 : 1 재고량: 9
주문량 : 2 재고량: 9
주문량: 2 재고량: 8
Consistent
In-­consistent
조회화면서비스구성 (Eventual  TX)
Product
(MongoDB)
Order
(MySQL)
Kafka
OrderPlaced
(pub)
OrderPlaced
(sub)
Client  (Web/Mobile)
POST
여기서 선택의 길을 만남
• 내 서비스에서 데이터 불일치가얼마나 미션크리티컬한가?
• 크리티컬 하다고 응답한다면, 내 서비스의 성능과확장성에비하여
크리티컬 한가?
• 성능과 확장성 보다 크리티컬 하다면, 성능과 확장성을 포기할 수 있는가?
• 성공한 내 서비스의 경쟁자들은무엇을 포기했는가?
• è 강력한 의사결정 필요 (무엇으로 태어날것인가…)
Eventual TX – 불일치가 Mission Critical 한 경우
Consistent
In-­consistent
조회화면서비스구성 (Eventual  TX)
Product
(MongoDB)
Order
(MySQL)
Kafka
OrderPlaced
(pub,  PENDING)
OrderPlaced
(sub)
Client  (Web/Mobile)
POST
All-­done
(pub)
All-­done
(sub,  CLEAR  PENDING)
주문량: 0 재고량: 10
주문량: 1 재고량: 10  (PENDING)
주문량 : 1 재고량: 9
주문량 : 2 재고량: 9  (PENDING)
주문량: 2 재고량: 8
Eventual TX
– Rollback (Saga Pattern)
주문량 : 0 재고량 : 10
주문량 : 1 재고량 : 10 (PENDING)
주문량 : 1  재고량 : 9
주문량 : 2 재고량 : 9 (PENDING)
주문량 : 2 재고량 : 8 à 취소됨
Consistent
In-­consistent
조회화면서비스구성 (Eventual  TX)
Product
(MongoDB)
Order
(MySQL)
Kafka
OrderPlaced
(pub,  PENDING)
OrderPlaced
(sub)
Client  (Web/Mobile)
POST
All-­done
(pub)
CANCELLED
(sub,  DELETE  or  CANCEL)
CANCELLED
(pub)
If~else
주문량 : 2 재고량 : 9
Resources on Sagas
▪ http://eventuate.io/
▪ https://vladmihalcea.com/how-to-extract-change-data-events-
from-mysql-to-kafka-using-
debezium/?fbclid=IwAR33Spb4jPBNI6VNHuCxdu_BxpWdz
OLzMvbCtHHvJrRmJPfiEoXwM1qWYBs
113
“
114
Data Query (Projection) in MSA
▪ Issues: Existing Join Queries and Performance Issues
▪ Composite Services or GraphQL
▪ Event Sourcing and CQRS
분산서비스에서의 Data Projection Issue
115
Order
id  :  3492-­2323
restaurant   :  Ajanta
Product
id:  3492-­2323
status:   PREPARED
Bill
id:  343-­45611
orderId :  3492-­2323
status   :  PAID
Delivery
id:  45-­4545
orderId :  3492-­2323
status   :  ENROUTE
eta   :  6  :  25  PM
Accounting   ServiceDelivery  ServiceProduct   ServiceOrder  Service
application
Order status view
Order id : 3492-2323
Restaurant : Ajanta
Status : En route
ETA : 6:25 PM
Payment : Paid
Order  status
frontend
OrderDetails findOrder(orderId)
Data  from  multiple  services Mobile  device  or  web  application
Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
Data Projection by UI and HATEOAS
116
Order
id  :  3492-­2323
restaurant   :  Ajanta
_links:{
ticket:    
http://products/3492-­
2323
delivery:  
http://deliveries/45-­
4545
bill:  http://bills/343-­
45611
}
Product
id:  3492-­2323
status:   PREPARED
Bill
id:  343-­45611
orderId :  3492-­2323
status   :  PAID
Delivery
id:  45-­4545
orderId :  3492-­2323
status   :  ENROUTE
eta   :  6  :  25  PM
Accounting   ServiceDelivery  ServiceProduct   Service
Order  Service
application
Order status view
Order id : 3492-2323
Restaurant : Ajanta
Status : En route
ETA : 6:25 PM
Payment : Paid
Order  status
frontend
Data  from  multiple  services Mobile  device  or  web  application
Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
1.  Fetch  first
2.  Fetch  second  in  parallel
Data Projection by Composite Service or
GraphQL
117 Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
≪aggregate≫
Charge
Accounting   Service
≪aggregate≫
Delivery
Delivery  Service
≪aggregate≫
Product
Product   Service
≪aggregate≫
Order
Order  Service
Find  Order
Composer
GET/orders/
{orderId}
GET/product
s?  orderId=
{orderId}
GET/deliveries?  
orderId=
{orderId}
GET/charges?  
orderId=
{orderId}
GET/order/{orderId}
Order status view
Order id : 3492-2323
Restaurant : Ajanta
Status : En route
ETA : 6:25 PM
Payment : Paid
Order  status
frontend
생각을 다르게 하자
: CQRS and Event-Sourcing
118
https://justhackem.wordpress.com/2016/09/
17/what-­is-­cqrs/
https://www.infoq.com/articles/microservice
s-­aggregates-­events-­cqrs-­part-­1-­richardson
• CQRS 패턴
• 읽기전용 DB와 쓰기 DB를
분리함으로써 Optimistic Locking 구현
• Query 뷰를 다양하게 구성하여 여러
MSA 서비스 목적에 맞추어 각 서비스의
리드모델에 부합
• Polyglot Persistence
CQRS 의 확장 : Multiple Event Sources
119
Order  Service
Product
Service
Delivery  
Service
Accounting  
Service
My  Page
Service
My  Page
view   database
Order
Events
Product
Events
Delivery
Events
Accounting
Events
findMyHistory(  )
Event
handlers
(Materialized  View)
Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
Requirements / Check
Category Requirement Solution
Maintainability  
  Scalability
24*365 Zero  Down  time Self-­Healing,  Horizontally  Scale
Minimal  Dev-­Ops,  Dev-­Dev  team  side  
effects  in  deploy  time
(more  than  100  deploys  per  day)
Loose  coupled  design  (HATEOAS  API,  
Service  Decomposition),  PubSub
Auto  Provisioning (by  docker
containerizing)
DevOps  CI/CD
Scalability  
Reusability
Multi-­channel  Support Responsive  Web, Chat  Bot
Dynamic Service  Composition Dynamic  Discovery/Composition, BPM
Usability    
Performance
Fast  browsing,  Single  Page, DDoS
protection,  Inter-­microservice integration
Client-­side  UI  rendering,  API  Gateway,  
Circuit Breaker,  Event-­driven  Arch.
Security For  all services including  3rd-­party  ACL Access  Token,  IAM
120
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall
2. Architecture  and  Approach  Overview
3. Domain  Analysis  with  DDD  and  Event  Storming
4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS
5. Monolith  to  Microservices
6. Front-­end  Development  in  MSA
7. Service  Composition  with  Request-­Response  and  Event-­driven  
8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
“
122
DevOps
▪ DevOps Process and Tools
▪ Deploy Strategies
▪ Containers and Orchestrators
▪ Cloud Foundry, Bluemix, and Kubernetes
https://www.youtube.com/watch?v=_I94-­tJlovg
Process Change: 열차말고 택시를 타라!
123
모노리식 개발 및 운영환경
• 모노리식 환경하에서는 큰 개발팀이 하나의 소스코드레파지토리에 변경 사항을
커밋하므로 코드간 상호 의존도가 높아 신규 개발 및 변경이 어려움
• 작은 변경에도 전제를 다시 테스트/ 배포하는 구조이므로통합 스케줄에 맞춘 파이프
라인을 적용하기가 어렵고 Delivery 시간이 과다 소요
마이크로서비스 개발 및 운영환경
• 작고 분화된 조직에서 서비스를 작은 크기로 나누어 개발하므로해당 비즈니스 로직에만
집중하게 되어 개발 생산성 향상
• 연관된 마이크로서비스만 테스트를 수행하므로 개발/테스트/배포 일정이 대폭 축소
CI Backlog
Manual
testing
어플리케이션
Production
Deployment  pipeline
Source
Code
repository
큰
개발조직
하나의 코드
레파지토리
코드 커밋에서 테스트,
운영환경 배포과정 힘듬
크고,  복잡,  
유지보수가 어려움
서비스
Production
Deployment  pipeline
Source
Code
repository
서비스
Deployment  pipeline
Source
Code
repository
Automated CI / CD 서비스
Deployment  pipeline
Source
Code
repository
작고,  
자율적이며,  
느슨한 조직
구조
하나의
서비스가
하나의
레파지토리
각 서비스가 자신의 자동화된
배포 파이프라인을 가짐
작고,  단순,  
유지보수가 용이
Automated CI / CD
Automated CI / CD
Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
Process Change: Consumer-driven Test
124 Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
• MSA 테스트에는 Contract-
based Test가 특징적
• API Consumer가 먼저 테스트
작성
• API Provider가 Pull Request
수신 후 테스트는 자동으로
생성됨
• Consumer 측에 Mock 객체가
자동생성 병렬개발이 가능해짐
• Spring Cloud Contract가 이를
제공
• Provider의 일방적인 버전업에
따른 하위 호환성 위배의
원천적 방지
특징
MSA 서비스의 테스트
Maven  repository
Contract.make{
Request{..}
Response{…}
}
…Service-­
Order  Service
contract  test
suite
API  gateway
Integration  test
API  gateway
Published
contract
API  gateway  team
Order  Service  team
Order
Service
2
Code  generated
from
1
Writes
Tests
Develops
Tests
Develops
Publishes
3
Reads
4
• 컨트랙트 테스트는 서비스 수요자가 주도하여 테스트를 작성한다. 수요자가 테스트를 작성하여 제공자의
레포지토리에 Pull-Request 하면, 제공자가 이를 Accept 한후에 제공자측에서 테스트가 생성되어 테스트가
벌어진다.
DevOps toolchain
125
CI/CD Tools – conventional CI/CD
126
❑ 잦은 배포
❑ 일반 서버에 배포
❑ 테스트 자동화/커버리지
❑ 도구: Jenkins,  Travis,  Gitlab 등
CI/CD Tools – Container-based
127
❑ Immutable  Image
❑ API  Testing
❑ Blue/Green,  Canary
❑ 도구: Jenkins  +  Docker  +  Spinnaker  +  Helm  +  Kubernetes
à 매우복잡
CI/CD Tools - Serverless
128
❑ Infrastructure  As  A  Code
❑ Application  Configuration  과 Infra
Configuration을 하나의 설정에
통합
❑ 단일 도구
비교
129
DevOps
DevOps Platforms
▪ IBM Bluemix
▪ Heroku
▪ GE’s Predix
▪ Pivotal Web Services
• Cloud  Foundry
Container Workload  Distribution  Engine
(Container  Orchestrator) PaaS
• Warden(Garden)
• Docker • Kubernetes
• Docker  SWARM  (toy)
• Mesos Marathon  (DCOS)
• Google  Compute  Engine
• Redhat Open  Shift
• IBM  Bluemix
• Amazon  ECS
• Hypervisor • CF  version  1
• Engineyard….  
• Amazon  Beanstalk

Mais conteúdo relacionado

Mais procurados

Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...Atlassian 대한민국
 
주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사
주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사
주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사Open Source Consulting
 
Private PaaS with Docker, spring cloud and mesos
Private PaaS with Docker, spring cloud and mesos Private PaaS with Docker, spring cloud and mesos
Private PaaS with Docker, spring cloud and mesos uEngine Solutions
 
[Atlassian meets dev ops and itsm] infrastructure for devops
[Atlassian meets dev ops and itsm] infrastructure for devops[Atlassian meets dev ops and itsm] infrastructure for devops
[Atlassian meets dev ops and itsm] infrastructure for devopsOpen Source Consulting
 
Process Oriented Architecture
Process Oriented ArchitectureProcess Oriented Architecture
Process Oriented ArchitectureuEngine Solutions
 
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브Open Source Consulting
 
Open Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS SnapshotsOpen Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS SnapshotsuEngine Solutions
 
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅Open Source Consulting
 
From event storming to spring cloud implementation
From event storming to spring cloud implementationFrom event storming to spring cloud implementation
From event storming to spring cloud implementationuEngine Solutions
 
클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1Chimin Park
 
Distributed transanction in microservices
Distributed transanction in microservicesDistributed transanction in microservices
Distributed transanction in microservicesuEngine Solutions
 
[Atlassian meets dev ops and itsm] kakao meets jira
[Atlassian meets dev ops and itsm] kakao meets jira[Atlassian meets dev ops and itsm] kakao meets jira
[Atlassian meets dev ops and itsm] kakao meets jiraOpen Source Consulting
 
AI = SE , giip system manage automation with A.I
AI = SE , giip system manage automation with A.IAI = SE , giip system manage automation with A.I
AI = SE , giip system manage automation with A.ILowy Shin
 
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?VMware Tanzu Korea
 
[오픈소스컨설팅]Open Stack Summit 2017 Review
[오픈소스컨설팅]Open Stack Summit 2017 Review[오픈소스컨설팅]Open Stack Summit 2017 Review
[오픈소스컨설팅]Open Stack Summit 2017 ReviewOpen Source Consulting
 
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 almuEngine Solutions
 
Kakao meets jira
Kakao meets jiraKakao meets jira
Kakao meets jira호정 이
 

Mais procurados (20)

Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
 
주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사
주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사
주 52시간 시대의 Agile_ 오픈소스컨설팅 한진규 이사
 
Private PaaS with Docker, spring cloud and mesos
Private PaaS with Docker, spring cloud and mesos Private PaaS with Docker, spring cloud and mesos
Private PaaS with Docker, spring cloud and mesos
 
[Atlassian meets dev ops and itsm] infrastructure for devops
[Atlassian meets dev ops and itsm] infrastructure for devops[Atlassian meets dev ops and itsm] infrastructure for devops
[Atlassian meets dev ops and itsm] infrastructure for devops
 
Process Oriented Architecture
Process Oriented ArchitectureProcess Oriented Architecture
Process Oriented Architecture
 
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
 
Open Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS SnapshotsOpen Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS Snapshots
 
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
 
Atlassian ITSM Case-study
Atlassian ITSM Case-studyAtlassian ITSM Case-study
Atlassian ITSM Case-study
 
From event storming to spring cloud implementation
From event storming to spring cloud implementationFrom event storming to spring cloud implementation
From event storming to spring cloud implementation
 
Open infra and cloud native
Open infra and cloud nativeOpen infra and cloud native
Open infra and cloud native
 
클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1
 
Distributed transanction in microservices
Distributed transanction in microservicesDistributed transanction in microservices
Distributed transanction in microservices
 
[Atlassian meets dev ops and itsm] kakao meets jira
[Atlassian meets dev ops and itsm] kakao meets jira[Atlassian meets dev ops and itsm] kakao meets jira
[Atlassian meets dev ops and itsm] kakao meets jira
 
AI = SE , giip system manage automation with A.I
AI = SE , giip system manage automation with A.IAI = SE , giip system manage automation with A.I
AI = SE , giip system manage automation with A.I
 
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
 
[오픈소스컨설팅]Open Stack Summit 2017 Review
[오픈소스컨설팅]Open Stack Summit 2017 Review[오픈소스컨설팅]Open Stack Summit 2017 Review
[오픈소스컨설팅]Open Stack Summit 2017 Review
 
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
 
IBM Bluemix
IBM BluemixIBM Bluemix
IBM Bluemix
 
Kakao meets jira
Kakao meets jiraKakao meets jira
Kakao meets jira
 

Semelhante a Event storming based msa training commerce example

All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...
All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...
All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...BESPIN GLOBAL
 
[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저
[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저
[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저Amazon Web Services Korea
 
KOPENS_INTRODUCTION_2014
KOPENS_INTRODUCTION_2014KOPENS_INTRODUCTION_2014
KOPENS_INTRODUCTION_2014Lee Sangboo
 
AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기
AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기
AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기Amazon Web Services Korea
 
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...Amazon Web Services Korea
 
Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례
Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례
Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례미래웹기술연구소 (MIRAE WEB)
 
AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기
AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기
AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기Amazon Web Services Korea
 
제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018 제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018 Amazon Web Services Korea
 
Confluent와 함께 Data in Motion 실현
Confluent와 함께 Data in Motion 실현Confluent와 함께 Data in Motion 실현
Confluent와 함께 Data in Motion 실현confluent
 
AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018
AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018
AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018Amazon Web Services Korea
 
[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)
[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)
[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)Lowy Shin
 
Modernize your business with erp cloud
Modernize your business with erp cloudModernize your business with erp cloud
Modernize your business with erp cloudOracle Korea
 
[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례
[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례
[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례Amazon Web Services Korea
 
B2B ISV가 이끈 리테일의 혁신 - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...
B2B ISV가 이끈 리테일의 혁신  - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...B2B ISV가 이끈 리테일의 혁신  - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...
B2B ISV가 이끈 리테일의 혁신 - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...Amazon Web Services Korea
 
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSAVMware Tanzu Korea
 
Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신
Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신
Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신AgileKoreaConference Alliance
 
왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018
왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018
왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018Amazon Web Services Korea
 
발표자료 개선플러스 현장개선제안솔루션_v8
발표자료 개선플러스 현장개선제안솔루션_v8발표자료 개선플러스 현장개선제안솔루션_v8
발표자료 개선플러스 현장개선제안솔루션_v8lee eunjoo
 
제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018Amazon Web Services Korea
 
변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...
변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...
변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...Amazon Web Services Korea
 

Semelhante a Event storming based msa training commerce example (20)

All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...
All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...
All about Data Center Migration Session 1. <Case Study> 오비맥주 사례로 알아보는 DC 마이그레...
 
[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저
[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저
[Retail & CPG Day 2019] 유통 고객의 AWS 도입 동향 - 박동국, AWS 어카운트 매니저, 김준성, AWS어카운트 매니저
 
KOPENS_INTRODUCTION_2014
KOPENS_INTRODUCTION_2014KOPENS_INTRODUCTION_2014
KOPENS_INTRODUCTION_2014
 
AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기
AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기
AWS Finance Symposium_바로 도입할 수 있는 금융권 업무의 클라우드 아키텍처 알아보기
 
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
 
Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례
Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례
Sencha ExtJS를 활용한 물류 통합 관리솔루션 개발 사례
 
AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기
AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기
AWS Finance Symposum_AWS 로 빅데이터 분석을 쉽고 간단하게 시작하기
 
제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018 제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례:: 이현석::AWS Summit Seoul 2018
 
Confluent와 함께 Data in Motion 실현
Confluent와 함께 Data in Motion 실현Confluent와 함께 Data in Motion 실현
Confluent와 함께 Data in Motion 실현
 
AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018
AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018
AWS와 함께 하는 클라우드 비즈니스 (임성은 매니저, AWS) :: AWS TechShift 2018
 
[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)
[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)
[giip] A.I. Infrastructure Advisor (인공지능 인프라 어드바이저)
 
Modernize your business with erp cloud
Modernize your business with erp cloudModernize your business with erp cloud
Modernize your business with erp cloud
 
[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례
[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례
[Partner TechForum] 고객을 360도로 이해하고 수익으로 연결하는 글로벌 선도 금융 기업들의 데이터 플랫폼 활용 사례
 
B2B ISV가 이끈 리테일의 혁신 - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...
B2B ISV가 이끈 리테일의 혁신  - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...B2B ISV가 이끈 리테일의 혁신  - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...
B2B ISV가 이끈 리테일의 혁신 - 조효원 AWS 테리토리 매니저 / 김명환 CTO, 메쉬코리아 / 이광우 CDP사업총괄, 아이지에이...
 
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA
 
Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신
Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신
Amazon & AWS의 MSA와 DevOps, 그리고 지속적 혁신
 
왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018
왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018
왜 우리는 마이크로서비스를 구현하고자 하는가?::김민성,이준희::AWS Summit Seoul 2018
 
발표자료 개선플러스 현장개선제안솔루션_v8
발표자료 개선플러스 현장개선제안솔루션_v8발표자료 개선플러스 현장개선제안솔루션_v8
발표자료 개선플러스 현장개선제안솔루션_v8
 
제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018
제조업의 AWS 기반 주요 워크로드 및 고객 사례::이현석::AWS Summit Seoul 2018
 
변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...
변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...
변화와 혁신을 위한 클라우드 마이그레이션 – 김진우 AWS 어카운트 매니저, 이아영 네오위즈 가버너스팀 팀장, 박주희 우아한형제들 시스템신...
 

Mais de uEngine Solutions

이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기
이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기
이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기uEngine Solutions
 
Safe cloud native transformation approaches
Safe cloud native transformation approachesSafe cloud native transformation approaches
Safe cloud native transformation approachesuEngine Solutions
 
microservice architecture public education v2
microservice architecture public education v2microservice architecture public education v2
microservice architecture public education v2uEngine Solutions
 
Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례uEngine Solutions
 
Building multi tenancy enterprise applications - quick
Building multi tenancy enterprise applications - quickBuilding multi tenancy enterprise applications - quick
Building multi tenancy enterprise applications - quickuEngine Solutions
 
Building multi tenancy enterprise applications
Building multi tenancy enterprise applicationsBuilding multi tenancy enterprise applications
Building multi tenancy enterprise applicationsuEngine Solutions
 
성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택uEngine Solutions
 
9 design factors for cloud applications
9 design factors for cloud applications9 design factors for cloud applications
9 design factors for cloud applicationsuEngine Solutions
 
Front-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and PolymerFront-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and PolymeruEngine Solutions
 
객체지향프로그래밍 특강
객체지향프로그래밍 특강객체지향프로그래밍 특강
객체지향프로그래밍 특강uEngine Solutions
 
Open source apm scouter를 통한 관제 관리 jadecross 정환열 수석
Open source apm scouter를 통한 관제  관리 jadecross 정환열 수석Open source apm scouter를 통한 관제  관리 jadecross 정환열 수석
Open source apm scouter를 통한 관제 관리 jadecross 정환열 수석uEngine Solutions
 
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱uEngine Solutions
 
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사uEngine Solutions
 

Mais de uEngine Solutions (16)

이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기
이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기
이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기
 
Safe cloud native transformation approaches
Safe cloud native transformation approachesSafe cloud native transformation approaches
Safe cloud native transformation approaches
 
microservice architecture public education v2
microservice architecture public education v2microservice architecture public education v2
microservice architecture public education v2
 
Micro service architecture
Micro service architectureMicro service architecture
Micro service architecture
 
Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례
 
Building multi tenancy enterprise applications - quick
Building multi tenancy enterprise applications - quickBuilding multi tenancy enterprise applications - quick
Building multi tenancy enterprise applications - quick
 
Building multi tenancy enterprise applications
Building multi tenancy enterprise applicationsBuilding multi tenancy enterprise applications
Building multi tenancy enterprise applications
 
Metaworks4 intro
Metaworks4 introMetaworks4 intro
Metaworks4 intro
 
Essencia 2017
Essencia 2017Essencia 2017
Essencia 2017
 
성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택
 
9 design factors for cloud applications
9 design factors for cloud applications9 design factors for cloud applications
9 design factors for cloud applications
 
Front-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and PolymerFront-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and Polymer
 
객체지향프로그래밍 특강
객체지향프로그래밍 특강객체지향프로그래밍 특강
객체지향프로그래밍 특강
 
Open source apm scouter를 통한 관제 관리 jadecross 정환열 수석
Open source apm scouter를 통한 관제  관리 jadecross 정환열 수석Open source apm scouter를 통한 관제  관리 jadecross 정환열 수석
Open source apm scouter를 통한 관제 관리 jadecross 정환열 수석
 
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
 
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사
 

Event storming based msa training commerce example

  • 1. Event-Storming based MSA training Copyright © 2018. Jinyoung Jang & uEngine-solutions All rights reserved.
  • 2. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 3. 3 • 상호명 :  12번가 • Vision  &  Mission “고객으로부터 신뢰받는 최고의 커머스 포털” Target Domain : 온라인 쇼핑몰 (12번가) • 우리는 세상 모든 것을 판매하는 쇼핑의 관문으로의 진화를 꿈꿉니다.  고객이원하는 모든유형의 상품과 서비스를 만날 수 있는 곳,  바로 12번가입니다. • 우리는 우리의 기술로 탐색부터 구매까지,  쇼핑의 모 든 과정에서 고객에게 최적의솔루션을제공할수 있 을 것이라 믿습니다.  쇼핑에 관한절대적인편의를제 공하는 곳,  바로 12번가입니다. • 우리는 고객의 슬기로운 쇼핑생활을 위해끊임없이 노력하고 있습니다.  풍성한 콘텐츠로 쇼핑그 이상의 재미와 감동을 선사하는 곳,  바로12번가입니다.
  • 4. 4 12번가 User Stories • MD가 상품정보(상품ID,  상품명,  상품가격,  재고수량,  설명,  추천ID)를 등록/  수정/  삭제한다. • 고객이 주문과 취소를 함에 따라서 상품 재고량이 변경된다. • 고객이 상품명으로 조회 시,  상품정보가 조회 된다. • 시스템이 상품을 출력할 때,  추천 상품들이 동시에 출력된다. • 품절된 상품에 대해서는 구매 대기가 가능하다. • 품절된 상품이 재 입고될 때,  구매 대기 목록에 있는 고객에게 알림이 발송된다. • 고객이 상품관련 질문을 올리면 MD가 회답한다. • 고객이 상품을 장바구니에 담는다. • 고객이 주문할 때,  상품과 구매개수 및 옵션을 선택한다. • 고객이 주문내역 변경(수정,  취소)이 가능하다. • 주문상태가 변경될 때마다 고객에게 알림이 가야 한다. • “카드결제” 결제 시 결제대행사가 한도체크 및 결제행위를 실행된다. • 주문취소가 완료되면 결제된 금액은 자동으로 환불된다. • 시스템은 결제 완료된 주문의 배송 정보를 물류사에 전달한다. • 배송정보에는 상품ID,  주문정보,  고객정보 등의 내용이 포함된다. • 고객이 배송중인 상품에 대해 배송현황 조회가 가능하다. • 고객이 입력한 배송관련 질의사항은 배송팀에서 대응한다. • 시스템은 고객의 배송완료 또는 반품완료 시,  고객에게 상태 알림을 제공한다. • 주문취소는 주문상품 반품,  환불완료가 되면 최종 주문취소가 완료된다. • 고객의 상품관련 컴플레인은 상품관리팀에게 연결이 된다. • 구매자에 대해,  잦은 주문 (승인 및 취소)  반복 시 블랙리스트로 등록되고,  등록된 사용자는 주문 시에 대한 규제를 가한다. • 판매자에 대해,  물품 배송이 자주 지연될 경우(기간 내 몇 회 이상),  잘못된 정보로 홍보할 경우(기간 내 몇 건 이상),  고객 불만 사항이 많을 경우(기간 내 몇 건 이상),  판매자가 블랙리스트로 될 경우 상품 등록 시 규제를 가한다. • 모든 비즈니스 메일은 마케팅 관리팀에서 발송을 담당한다.
  • 5. 5 Teaming & KPI Definition 상품관리팀 주문/결제관리팀 배송관리팀12 번가 고객센터팀 마케팅팀 가성비 높은 상품 제공 통한 매출 증대 안정되고 정확한 주문/취소를 통한 고객 만족 빠른 배송 추적 통한 고객 만족 고객 불만 대응성 고객 맞춤화된 상품 제공통한 구매력 증대
  • 6. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 7. AS-IS: Pain-points • 운영팀과 개발팀이 분리되어 개발팀의 반영을 운영팀이 거부하는 사례 발생 • 개발팀은 새로운 요건을 개발했으나, 이로인해 발생하는 오류가 두려워 배포를 꺼려함 • 현재 미국, 일본, 유럽 등 수요가 늘어나는 상황이나, 상기한 문제로 신규 고객의 요구사항을 받아들이지 못하는 상황 • 수동 운영의 문제로, SLA 준수가 되지 못하여 고객 클레임이 높은편 • 기존 모놀로씩 아키텍처의 한계로 장기적인 발전의 한계에 봉착 • 서비스 업그래이드가 수시로 요청이 들어와 거의 매일 야근중. 개발자 행복지수가 매우 낮음. • 한팀의 반영이 전체팀의 반영에 영향을 주어 거의 매일 야근해야 함. 행복지수 낮음을 토로함. • 테넌트별 다형성 지원을 제대로 하지 못하여 가입고객이 늘 때마다 전체 관리 비용이 급수로 올라가는 한계에 봉착함 • 자체 IDC를구성하여 하드웨어, 미들웨어 구성을 직접해야 하는 비용문제.
  • 8. 8 Ⅱ. AgileValue& Principles Delivery & Requirement management MVP(Minimum Viable Product) & Incremental   delivery S/W   Engineering Test driven   Development   & Continuous   Refactoring   Technical Design Loosely   Coupled   Architecture Process   & Collaboration Continuously   Improving Loose To be Agile
  • 9. DevOps: Issues Continuous Delivery 9 Company Deploy  Frequency Deploy  Lead  Time Reliability Customer   Responsiveness Amazon 23,000   /  day Minutes High High Google 5,500   /  day Minutes High High Netflix 500   /  day Minutes High High Facebook 1  /  day Hours High High Twitter 3  /  week Hours High High Typical  enterprise Once   every  9  months Months   or  quarters Low  /  Medium Low  /  Medium 출처:  도서 The  Phoenix   Project Amazon,
  • 14. Monolithic Architecture à 모든 서비스가 한번에 재배포 à 한팀의 반영을 위하여 모든 팀이 대기 à 지속적 딜리버리가 어려워
  • 15. Jeff Bezos Mandate 1. All teams will henceforth expose their data and functionality through service interfaces. 2. Teams must communicate with each other through these interfaces. 3. There will be no other form of interprocess communication allowed: no direct linking, no direct reads of another team's data store, no shared- memory model, no back-doors whatsoever. The only communication allowed is via service interface calls over the network. … 4. The team must plan and design to be able to expose the interface to developers in the outside world. No exceptions. 5. Anyone who doesn't do this will be fired. 11
  • 16. Approach #1: Micro Service Architecture Contract based, Polyglot Programming à Separation of Concerns, Parallel Development, Easy Outsourcing Written  in  Java Written  in  Node Written  in  PHP
  • 17. Approach #2: Event Driven Architecture Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­ systems-­with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 18. Monolith: • With  Canonical  Model • (“Rule  Them  All”  model) Reactive  Microservices: • Autonomously  designed  Model(Document) • Polyglot  Persistence E E Approach #2: Event Driven Architecture Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­with-­event-­ storming-­73c6236f5dd7,  Kevin  webber
  • 20. 효과 – 장애 최소화 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 데이 터베 이스 재무 데이 터베 이스 생산 데이 터베 이스 인사 장애가 전파되며, 수동 복구로 장애지연 장애가 격리되며, 자동으로복구됨(이전버전)
  • 21. Java/J2EE 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 RDB 재무 (Java/ Tomc at) RDB 생산 (Java/ Spring) RDB 인사 (.NET) 효과 – 기능 확장 수익 성 분석 스키 마 체인 지 No SQL 수익 성 분석 (pytho n) 기존 코드의 수정 à Big  Impact 신규 마이크로서비스의 추가 à Minimal  Impact 자율적 기술선택(플랫폼  데이터레이아웃)
  • 22. Java/J2EE 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 RDB 재무 (Java/ Tomc at) 생산 (Java/ Spring) RDB 인사 (.NET) 효과 – 기능 확장 수익 성 분석 스키 마 체인 지 No SQL 수익 성 분석 (pytho n) 기존 코드의 수정 à Big  Impact 신규 마이크로서비스의 추가 à Minimal  Impact 자율적 기술선택(플랫폼  데이터레이아웃)
  • 23. 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 재무 생산 인사 효과 – 성능 배분 생산 계획 생산 계획 스케일업을 통해서만확장 수익성 분석의 워크로드에대한 스케일 아웃용이 생산 계획
  • 24. Micro Service Architecture ▪변경된 서비스만 재배포 à Side effect 최소화 ▪자율성 à 각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이 ▪병렬 개발, 타임 투 마켓, 린 개발
  • 25. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 26. Domain-Driven Design MSA ▫ Bounded Context à 어떤 단위가 마이크로 서비스가 될 수 있는가? ▫ Context Mapping à 서비스를 결합 할 때는 어떻게 결합할 것인가? ▫ Domain Events à Event-driven Architecture 도출 DDD for MSA Applicable Practices: ㄱ. 이벤트 스토밍과 BPMN: 이벤트, 커맨드, 액터, 어그리게이트 식별 ㄴ. UML 과 컨텍스트 맵: 보편언어, 바운디드 컨텍스트 식별
  • 28. DDD: Domain Object Classifications 24 Classification Description Example Domain Event ▪ Captures  the  memory  of  something   interesting  which  affects  the  domain ▪ I  go  to  Babur's  for  a  meal  on  Tuesday,  and  pay   by  credit  card.  This  might  be  modeled  as  an   event,  whose  event  type  is  'make  purchase',   whose  subject  is  my  credit  card,  and  whose   occurred  date  is  Tuesday.  If  Babur's  uses  an   old  manual  system  and  doesn't  transmit  the   transaction  until  Friday,  the  noticed  date  would   be  Friday. Entity and Aggregate ▪ Objects that have a distinct identity that runs through time and different representations. ▪ Usually big things like Customer, Ship, Rental Agreement. Service ▪ A standalone operation within the context of your domain. A Service Object collects one or more services into an object. Typically you will have only one instance of each service object type within your execution context. ▪ Services are usually accesses to external resources like Database Connection, Messaging Gateway, Repository, Product Factory.
  • 29. Event Storming: DDD 를 쉽게하는 방법 ▪이벤트스토밍은 시스템에서 발생하는 이벤트를 중심 (Event-First) 으로 분석하는 기법으로 특히 Non-blocking, Event-driven 한 MSA 기반 시스템을 분석에서 개발까지 필요한 도메인에 대한 탁월하게 빠른 이해를 도모하는데 유리하다. ▪기존의 유즈케이스나 클래스 다이어그래밍 방식은 고객 인터뷰나 엔티티 구조를 인지하는 방식과 다르게 별다른 사전 훈련된 지식과 도구 없이 진행할 수 있다. ▪진행과정은 참여자 워크숍 방식의 방법론으로 결과는 스티키 노트를 벽에 붙힌 것으로 결과가 남으며, 오랜지색 스티키 노트들의 연결로 비즈니스 프로세스가 도출되며 이들을 이후 BPMN과 UML 등으로 정재하여 전환할 수 있다. vs.
  • 30. What’s an Event? An  Event  message  is  non-­prescriptive  of  what  should  happen  in  other services.   Events  always  carry  a  name  in  its  past-­tense  form: OrderWasAccepted,  OrderHasShipped,  CustomerWasReimbursed Other  qualities • Immutable,  i.e.  content  cannot  be  changed • Always  carries  the  ID  of  the  Business  Object  it  relates  to • An  event  can  and  will  typically  will  be  published  to  multiple consumers. – The  publisher   of  the  event  does  not  know  who  the  recipients  are
  • 31. Event Flows: Timeline-based Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­ with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 32. Policy: Reactions triggered by Event “Whenever a new user account is createdwe will send her an acknowledgement by email”. Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­ with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 33. Decomposing Mi-Svc : Finding Aggregate Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­ with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 34. Decomposing Mi-Svc : Bounded Contexts Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­ with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 35. Lab Time – Event 들을 먼저 도출 상품등록됨 상품재고 변경됨 상품삭제됨 주문생성됨 주문정보 변경됨 주문취소됨 배송출발함 배송취소 요청됨 우리 서비스에는 어떤 비즈니스이벤트들이 발생하는가? 현업이 사용하는 용어를 그대로사용 (Ubiquitous  Language) 용어의 namespace  를 구지 나누려는노력을하지 않음 상품정보 변경됨 주문상태 변경됨 배송준비됨 배송완료됨
  • 36. Lab Time – Policy 도출 어떤 이벤트에 이어서 곧바로 항상 발생해야하는 업무규칙 구현상에서는 이벤트의 Publish에 따라 벌어지는 이후의프로세스가자동으로트리거 되게 함 상품등록됨 상품재고 변경됨 주문생성됨 주문정보 변경됨 배송출발함배송준비됨 홍보 메일발송 입고 메일발송 배송생성 배송정보 변경 배송지시 알림메일 발송 상품삭제됨 주문취소됨 배송취소 요청됨 상품정보 변경됨 주문상태 변경됨 배송완료됨 배송취소 알림메일 발송 회수지시 재고변경 재고변경 재고변경
  • 37. 주문취소 수신 완료수신 출발수신주문생성 수신 주문취소주문취소 정보변경결제클릭 재고변경 Lab Time – Command 도출 (쓰기행위) Event를 발생시키는 명령은무엇인가? UI를 통해?  or  시간도래? or  다른 이벤트에 의해? Command  는 어떠한 상태의 변화를 일으키는서비스를 말함. *  Command 라는 용어는 CQRS  에서 유래했으며, 쓰기서비스인Command  와 읽기행위인Query는구분됨. 상품재고 변경됨 주문생성됨 주문정보 변경됨 배송출발함 배송준비됨 입고 메일발송 배송생성 배송정보 변경 배송지시 알림메일 발송 상품등록 상품등록됨 상품삭제정보변경 상품삭제됨 주문취소됨 배송취소 요청됨 상품정보 변경됨 주문상태 변경됨 배송완료됨 배송취소 알림메일 발송 회수지시 홍보 메일발송 재고변경 재고변경 재고변경
  • 38. 주문취소 수신 완료수신 출발수신주문생성 수신 주문취소주문취소 정보변경결제클릭 재고변경 Lab Time – Command Actor 식별 Actor  는 Command를 발생시키는주체 담당자 또는 시스템 (외부 (External)  또는 내부)이될 수 있음 상품재고 변경됨 주문생성됨 주문정보 변경됨 배송출발함 배송준비됨 입고 메일발송 배송준비 배송정보 변경 배송지시 알림메일 발송 상품등록 상품등록됨 상품삭제정보변경 상품삭제됨 주문취소됨 배송취소 요청됨 상품정보 변경됨 주문상태 변경됨 배송완료됨 배송취소 알림메일 발송 회수지시 홍보 메일발송 MD MD MD 사용자 사용자 사용자 사용자 시스템 시스템 시스템 시스템 MD 재고변경 재고변경 재고변경
  • 39. Lab Time – Aggregate 도출 (데이터모델) 도메인 이벤트가 발생하는데는, 어떠한 도메인 객체의변화가 발생했기 때문이다. 하나의 ACID  한 트랜잭션에 묶여 변화되어야 할 객체의묶음을 도출하고,그것들을커맨드, 이벤트와함께 묶는다. 주문취소 수신 완료수신 출발수신 주문생성 수신 주문취소 주문취소 정보변경 결제클릭 재고변경 상품재고 변경됨 주문생성됨 주문정보 변경됨 배송출발함 배송준비됨 입고 메일발송 배송생성 배송정보 변경 배송지시 알림메일 발송 상품등록 상품등록됨 상품삭제 정보변경 상품삭제됨 주문취소됨 배송취소 요청됨 상품정보 변경됨 주문상태 변경됨 배송완료됨 배송취소 알림메일 발송 회수지시 홍보 메일발송 상품 (Product) 주문 (Order) 배송 (Delivery) MD MD MD MD 사용자 사용자 사용자 사용자 시스템 시스템 시스템 시스템 재고변경 재고변경 재고변경
  • 40. Lab Time – Bounded Context 도출 개념적: • Bounded  Context  는 동일한 문맥으로 효율적으로 업무 용어 (도메인 클래스)를 사용할 수 있는 객체범위를 뜻한다. 하나의 BC  는 하나이상의 어그리게잇을 원소로 구성될 수 있다. BC를 Microservice 구성단위로 정하게 되면 이를 담당한 팀 내의 커뮤니케이션이 효율화된다. 구현관점: • 어그리게잇은 ACID  트랜잭션 범위이기도 하기때문에 이를 더 쪼개서 BC  를 구성할 수는 없다. BC  내의 어그리게잇들에 대한 보존 (Persistence)은 아마도 그 목적에 맞는 최적화된 데이터모델을 독립적으로 설계하고 구현할 수 있다. 주문취소 수신 완료수신 출발수신 주문생성 수신 주문취소 주문취소 정보변경 결제클릭 재고변경 상품재고 변경됨 주문생성됨 주문정보 변경됨 배송출발함 배송준비됨 입고 메일발송 배송생성 배송정보 변경 배송지시 알림메일 발송 상품등록 상품등록됨 상품삭제 정보변경 상품삭제됨 주문취소됨 배송취소 요청됨 상품정보 변경됨 주문상태 변경됨 배송완료됨 배송취소 알림메일 발송 회수지시 홍보 메일발송 상품 (Product) 주문 (Order) 배송 (Delivery) MD MD MD MD 사용자 사용자 사용자 사용자 시스템 시스템 시스템 시스템 상품관리 주문관리 배송관리 재고변경 재고변경 재고변경
  • 41. 12번가 Shopping Mall Bounded Context 주문취소 수신 완료수신 출발수신 주문생성 수신 배송출발함 배송준비됨 배송지시 알림메일 발송 배송취소 요청됨 배송완료됨 알림메일 발송 회수지시 배송 (Delivery) 시스템 시스템 시스템 시스템 재고변경 상품재고 변경됨 입고 메일발송 상품등록 상품등록됨 상품삭제 정보변경 상품삭제됨 상품정보 변경됨 홍보 메일발송 상품 (Product) MD MD MD MD 상품관리 배송관리 반품요청 접수 반품접수됨 접수메일 발송 반품 (Return) 담당자 고객센터 상품회수 요청 컴플레인 등록 컴플레인 등록됨 주문자 답변등록 답변등록됨 담당자 등록메일 발송 등록메일 발송 컴플레인 (Complain) VIP회원 등록 VIP등록됨 등록메일 발송 담당자 VIP회원 삭제 VIP해제됨 해제메일 발송 담당자 VIP (VIP) 주문취소 주문취소 정보변경 결제클릭 주문생성됨 주문정보 변경됨 배송생성 배송정보 변경 주문취소됨 주문상태 변경됨 배송취소 주문 (Order) 사용자 사용자 사용자 사용자 주문관리 재고변경 재고변경 재고변경 설문제출 설문응답등 록됨 등록 메일발송 설문등록 설문등록됨 설문진행 메일발송 설문조사 (Survey) 담당자 사용자 마케팅관리 캠페인 삭제 캠페인 삭제됨 캠페인등 록 캠페인 등록됨 캠페인 메일발송캠페인 (Campaign) 담당자 담당자 주문정보 조회 주문생성 수신 시스템 메일 로그 주문이력 추가됨 주문 이력 AI분석 요청지시
  • 42. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 43. Microservice Implementation Pattern (1) ▪Hexagonal Architecture ▫Create your service to be independent of either UI or database and to provide adapters for different input/output sources such as GUI, DB, test harness, RESTful resource, etc. ▫Implement the publish-and-subscribe messaging pattern: As events arrive at a port, an adapter (a.k.a. service agent) converts it into a procedure call or message and passes it to the application. When the application has something to publish, it does it through a port to an adapter, which creates the appropriate signals needed by the receiver. (https://alistair.cockburn.us/Hexagonal+archi tecture) 39 비즈니스 로직 Message consumer Message producer DAO Some Controller class Browser Message  broker Foo service Domain   Event Repository interface Inbound  port Inbound  adapter Inbound  adapter Outbound  port Outbound  port Database Outbound  adapter
  • 44. 40 ▪HATEOAS (Hypertext As The Engine Of Application State) ▫HATEOAS is deemed the highest maturity level of REST. (https://martinfowler.com/articles/richardsonMatu rityModel.html) ▫In the HATEOAS architecture, a client enters a REST application through a specific URL, and all future actions the client may take are discovered within resource representations returned from the server. ▫This self-contained discoverability can be a drawback for most service consumers who prefer API documentation. Microservice Implementation Pattern (2)
  • 45. Service Implementation ▪ You have Powerful Tool: Domain-Driven Design and Spring Boot / Spring Data REST ▪ Domain Classes : Entity or Value Object ▪ Resources can be bound to Repositories à Full HATEOAS service can be generated! ▪ Services can be implemented with Resource model firstly ▪ Low-level JAX-RS can be used if not applicable above 41
  • 46. Step 1: Applying Hexagonal Architecture 주문정보 입력 주문이 발생함 주문 (Order)  domain  model 주문 주문 (Order) Message consumer Message producer DAO ControllerBrowser Message  broker 과정정보 입력 주문이 발생함 Repository interface 커맨드 외부 도메인이벤트 도메인이벤트 Database
  • 47. Step 2: Applying MSA Chassis  MSA  chassis   Spring  Boot  /  Cloud 주문(Order) Message consumer Message producer DAO ControllerBrowser Message  broker 과정정보 입력 주문이 발생함 Repository interface Spring  Data  REST 외부 도메인이벤트 도메인이벤트 Database JPA Spring   Data   Rest Spring  Cloud  Stream JPA Spring  Data  Rest Spring  Boot
  • 48. Spring Boot: A MSA Chassis 44 • Simple  Java  (POJO) • Minimal  Understanding  Of  Frameworks  and  Platforms (Using  Annotations) • No  Server-­side  GUI  rendering   (Only  Exposes  REST  Service) • No  WAS  deployment  required (Code  is  server;;  Tomcat  embedded) • No  XML-­based  Configuration Main  Application Domain  Classes Services  and  Repositories Settings
  • 49. Lab: Create a Spring boot application 45 Go  to  start.spring.io Set  metadata: -­ Group:  com.example -­ Artifact:  12st-­mall -­ Dependencies: § H2 § Rest  Repositories § JPA Press  “Generate  Project” Extract  the  downloaded  zip  file Build  the  project: ./mvnw spring-­boot:run Port  충돌시: ./mvnw spring-­boot:run -­Dserver.port=8081
  • 50. Running Spring Boot Application 46 $ mvn spring-boot:run # 혹은 ./mvnw spring-boot:run [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building …. [INFO] ------------------------------------------------------------------------ [INFO] Downloading: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security- core/maven-metadata.xml [INFO] Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/springframework/security/spring -security-core/maven-metadata.xml [INFO] Downloading: https://repo.spring.io/libs-release : Started  Application  in  11.691  seconds  (JVM  running  for  14.505) Source code: $ git clone https://github.com/uengine-oss/software-modeling-class-management-monolith.git
  • 51. Test Generated Services 47 $ http localhost:8080 HATEOAS  links HTTP/1.1 200 Content-Type: application/hal+json;charset=UTF-8 Date: Wed, 05 Dec 2018 04:20:52 GMT Transfer-Encoding: chunked { _links: { profile: { href: http://localhost:8080/profile } } } HTTP  =  success
  • 52. Aggregate à Entity Class 작성 상품 주문 배송 @Entity public  class  Order  { @Id @GeneratedValue private  Long  id;; private  Long  productId;; private  String  productName;; private  int quantity;; private  int price;; private  String  customerName;; private  String  customerAddr;; @ManyToOne @JoinColumn(name=”productId) Product  product;; } @Entity public  class  Product  { @Id @GeneratedValue private  Long  id;; String  name;; int price;; int stock;; @OneToMany(  cascade  =   CascadeType.ALL,  fetch  =  FetchType.EAGER,   mappedBy =  ”order) ListOrde  orders;; } @Entity public  class  Delivery  { @Id  @GeneratedValue private  Long  deliveryId;; private  Long  orderId;; private  String  customerName;; private  String  deliveryAddress;; private  String  deliveryState;; @OneToOne Order  order;; }
  • 53. Commands à Service Object* 와 API의 생성 Repository  Pattern  으로 생성된것 사용할 수 있는 경우 주문과 배송 API  는 Order  Repository  에서 생성된 CRUD  actions  들 중 POST  Service   를 그대로 사용할 수 있으므로 별도 구현할 필요 없다. 마찬가지 주문서 수정, 삭제도 각각 PATCH,  DELETE  로 API  생성 전체의 약 7~80% 커버 Repository  에서 생성된 API  를 사용 못하는 경우, 별도 Spring  MVC  Service  로 생성 배송일정 등을 위한 백엔드 API  는 Order  Repository  에 생성된 PUT-­POST-­PATCH-­DELETE  중 적합한 것이 없으므로 별도 추가 action  URI를 만드는 것이 적합 나머지 2~30% 수준 @Service public  interface   ProductService { @RequestMapping(method   =  RequestMethod.GET,   path=/calendar/{deliveryId}/{date}) Resources   getProduct(@PathVariabl e(”deliveryId)   Long   deliveryId,   @PathVariable(date) String  date);; } public  interface   OrderRepository extends  PagingAndSortingR epositoryCourse,   Long   { ListCourse  findByOrderId(@Param(”orderId)   Long   OrderId);; } 상품정보 C.R.U.D 주문정보 C.R.U.D 배송정보 변경배송정보 C.R.U.D 재고변경컴플레인 ….  등등등 배송지시 배송알림 발송
  • 54. Main Class 50 @SpringBootApplication public  class  Application public  static  void  main(String[]  args)  { SpringApplication.run(Application.class,  args);; } }
  • 55. Test Generated Services 51 $ http localhost:8081 { _links: { ”products: { href: http://localhost:8081/products{?page,size,sort}, templated: true } } $ http localhost:8082 { {_links: { ”orders: { href: http://localhost:8082/orders{?page,size,sort}, templated: true } } $ http localhost:8083 { {_links: { ”deliverys: { href: http://localhost:8083/deliverys{?page,size,sort}, templated: true } } } HATEOAS  links
  • 56. Create new Order 52 $ http localhost:8082/orders productId=1 productName=TV quantity=1 customerName=홍길동 customerAddr=서울시 {        _links:  {        order:  {                href:  http://localhost:8082/orders/1        },        self:  {                href:  http://localhost:8082/orders/1        } },        customerAddr:  서울시,                customerName:  홍길동,                price:  0,                productId:  1,                productName:  TV,                quantity:  1 } URI  of  the  new  order
  • 57. Create a delivery of the order 53 $ http POST localhost:8083/deliverys deliveryState =“DeliveryStarted” orderId =http://localhost:8082/orders/1 $ http http://localhost:8083/deliverys/1/order URI  of  the  SOA   delivery {        _links:  {         self:  {                href:  http://localhost:8082/orders/1         } },        customerAddr:  서울시,                customerName:  홍길동,                price:  0,                productId:  1,                productName:  TV,                quantity:  1 } Delivery  is  aggregation  root
  • 58. Monolothic 에서의 분산 트랜잭션 – 이슈없음 주문량: 0 재고량: 10 주문량: 1 재고량: 9 Consistent In-­consistent 조회화면 서비스구성 (모놀로씩) Order (MySQL) Client  (Web/Mobile) POST Order Product 주문량: 2 재고량: 8
  • 59. Nice but Too big (monolith) 55 JPA HATEOAS   API /orders/* /products/* /deliverys/* Service   Object Generated   by  Spring Repositories: OrderRepository DeliveryRepository ProductRepository H2 Entity Order Entity Product Entity Delivery Entity New   Service Entity New   Service Entity YetAnother… …. Plan  to  add…
  • 60. Requirements / Check Category Requirement Solution Maintainability    Scalability 24*365 Zero  Down  time Self-­Healing,  Horizontally  Scale Minimal  Dev-­Ops,  Dev-­Dev  team  side   effects  in  deploy  time (more  than  100  deploys  per  day) Loose  coupled  design  (HATEOAS  API,   Service  Decomposition),  PubSub Auto  Provisioning (by  docker containerizing) DevOps  CI/CD Scalability   Reusability Multi-­channel  Support Responsive  Web, Chat  Bot Dynamic Service  Composition Dynamic  Discovery/Composition, BPM Usability     Performance Fast  browsing,  Single  Page, DDoS protection,  Inter-­microservice integration Client-­side  UI  rendering,  API  Gateway,   Circuit Breaker,  Event-­driven  Arch. Security For  all services including  3rd-­party  ACL Access  Token,  IAM 56 HATEOAS  API
  • 61. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 62. “ ▪From Monolith to Microservices 58 https://github.com/jinyoung/software-­modeling-­class-­management-­monolith à https://github.com/jinyoung/software-­modeling-­class-­management-­msa
  • 64. Lab Time – 마이크로서비스 도출 • 마케팅 관리와 고객센터 팀 내에는 서로 간의 간섭이 전혀 없는 복수 개의 어그리게잇으로 구성되어 있어 더 작은 마이크로서비스로 충분히 도출 가능함. 60
  • 65. Lab Time – Context Map 도출 개념적: • BC  간의 정보참조의 릴레이션, 혹은 이벤트가 발생한 이후의 동반된 행위의 호출의 관계를 선으로 표시함. Upstream  à Downstream  으로 정보가 내려가게 됨. 구현관점: • 자치적으로 구현설계가 이루어질 수 있는 BC  간에 커뮤니케이션을 위해서는 데이터의 적절한 변환이나 표준화, Pub/Sub  등의 커뮤니케이션 방법 및 데이터 전환에 대한 이슈가 발생하게 됨. 해당 이슈를 적절한 패턴을 선택하여 실제 연동을 위한 Adapter  를 개발해야 함.61
  • 66. Lab Time – Topology Consideration 라이락 스티커 (Policy)  를 어디에 둘 것인가? -­ Orchestration  or  Choreography?  Or  Mediation? Orchestration Choreography More  autonomy  to  handle  the  policy à Low-­Coupling à Easy  to  add  new  policies Originator  should  know  how  to  handle  the  policy à Coupling  is  High 62
  • 67. Ref: Relation types between services 63 Eric  Evans,  Domain-­Driven  Design,  2003. ▪Shared Kernel ▫Designate a subset of the domain model that the two teams agree to share. ▪Customer/Supplier ▫Make the downstream team play the customerrole to the upstreamteam. ▪Conformist ▫Eliminate the complexity of translationbetween boundedcontexts by slavishly adheringto the model of the upstream team. ▪Separate Ways ▫Declare a boundedcontext to have no connection to the others at all. The features can still be organized in middleware or the UI layer. ▪Open Host Service ▫Open the protocol so that all who need to integrate with you can use it. Other teams are forced to learn the particular dialect usedby the host team. In some situations, using a well- known publishedlanguage as the interchange model can reduce coupling and ease understanding.
  • 68. Issues in transforming Monolith to Microservices Order (Mongo  DB) Marketing (File  Sys) Product (H2) Delivery (RDB) Service-­Center (External) 강사 스케쥴 확인 (REST) Sub 강의 일정 발생 (Pub) MQ  (Kafka) 광고 메일 발송 (Sub)JPA Service  Object Generated  by   Spring Repositories: Cour seReposit or y ClazzReposit or y I nst r uct or Reposit or y H2 Ent it y Course Ent it y Clazz Ent it y Instructor Ent it y Schedule Ent it y Notificati on Ent it y Enrollme nt …. ? Ent it y Detail Ent it y Product Ent it y Delivery Ent it y … Ent it y … Ent it y Detail Ent it y YetAnother… REST  API REST  API API  Gateway 강 결합된 객체 참조 구조 Ent it y Order
  • 69. Solutions – 객체의 분리 65 • 참조해야 할 도메인 클래스들의 공통화 à Shared  Kernel,  Maven  Repo  등을 통한 공통 모델의 공유 : 동일 언어인 경우 유리, 디펜던시 발생 à 혹은 중복 모델 개발 : Polyglot  인 경우 유리 • Entity  분리에 따른 원격 객체 (어그리게잇) 참조 à Primary  Key  를 통해서만 참조 à HATEOAS  link  를 이용
  • 70. Solutions – API 통합 66 • API  Gateway   à 진입점의 통일 à Path-­based  Routing  (기존에 REST  로 된경우 가능) • Service  Registry à API  Gateway  가 클러스터 내의 인스턴스를 찾아가는 맵
  • 71. Solutions – 이벤트의 퍼블리시 67 • Aggregate  내 코드 주입 à 호출 코드 직접 주입, Hexagonal   Architecture  의 손상 à JPA  의 Lifecycle  Annotation  사용 • CDC  (Change  Data  Capturing)  기능 사용 à DB  의 Change  Log  를 Listening,  Event   자동퍼블리시 하는 툴 à Debezium,  Eventuate  Tram  등이 존재 레가시 시스템 New   서비스 Event pulisher Event handler Translation layer Messaging client Order event Event  channel Anti-­corruption   layer Ubiquitous   language   of  service Ubiquitous   language   of  monolith Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
  • 72. Legacy Transformation – Strangler Pattern 68 Strangler  application Service Service Service Service Service Service Service … Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Time Monolith Monolith Monolith Monolith … Monolith The   Monolith   shrinks  over  time. The   strangler  application Grows  larger  over  time. • Strangler 패턴으로 레가시의 모노리스 서비스가 마이크로서비스로 점진적 대체를 통한 Biz 임팩트 최소화를 통한 구조적 변화 • 기존에서 분리된 서비스 영역이 기존 모노리스와 연동 될 수 있도록 해주는 것이 필요. • 그 방법은 앞서 동기/ 비동기 방식이 채용될 수 있음 • 동기 – 레거시로 하여금 기존 소스코드 수정 요인이 높음, 따라서 이벤트 기반 비동기 연동 (CQRS) 추천 Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
  • 73. 마이크로 서비스간의 서열과 역학관계 69 1순위: Core  Domain 버릴 수 없는. 이 기능이 제공되지 않으면 회사가 망하는. 예) 쇼핑몰 시스템에서 주문, 카탈로그 서비스 등 2순위: Supportive  Domain 기업의 핵심 경쟁력이 아닌, 직접 운영해도 좋지만 상황에 따라 아웃소싱 가능한. 시스템 리소스가 모자라면 외부서비스를 빌려쓰는 것을 고려할만한 예) 재고관리, 배송, 회원관리 서비스 등 3순위: General  Domain SaaS  등을 사용하는게 더 저렴한, 기업 경쟁력과는 완전 무관한 예) 결재, 빌링 서비스 등 무엇을 우선적으로 챙길 것인가?
  • 74. 마이크로 서비스간의 서열과 역학관계 70 어느 마이크로 서비스의 인터페이스를 더 중요하게 관리할 것인가? 카탈로그 (core) 배송 SaaS (general,  외부서비스) 상품추천 (supportive) Core  Domain  간 (높은 서열끼리) 에는 Shared-­kernel  도 허용가능하다. 하지만, 중요도가 낮은 서비스를 위해 높은서열의 서비스가 인터페이스를 맞추는 경우는 없을 것이다. conformist Anti-­corruption 주문 (core) Shared-­kernel
  • 75. 마이크로 서비스간의 서열과 역학관계 71 마이크로서비스간 트랜잭션의 묶음을 어떻게 할 것인가? 재고 (core) 배송 상품추천 (supportive) 배송기사가 없다고 주문을 안받을 것인가? 상품 추천이 안된다고 주문버튼을 안보여줄 것인가? Core  Domain  간에는 강결합이 요구되는 경우가 생길 수 있다. 하지만 우선순위가 떨어지는 비즈니스 기능을 위해 강한 트랜잭션을 연결할 이유는 하등에 없다. UI  mashup Async Event-­driven Eventual  TX 주문 (core) ACID  TX (2PC)
  • 76. 마이크로 서비스간의 서열과 역학관계 72 손님이 많이 와서 집이 좁아졌다.. 무엇을 우선적으로 줄일 것인가? 주문 주문 배송 배송 상품 추천 주문 주문 주문 주문 상품 추천 배송서비스는 야간에 올라와서 후에 처리되어도 된다. 주문이 몰려드는 시간에 주문을 못받으면 배송은 의미가 없다
  • 77. Requirements / Check Category Requirement Solution Maintainability    Scalability 24*365 Zero  Down  time Self-­Healing,  Horizontally  Scale Minimal  Dev-­Ops,  Dev-­Dev  team  side   effects  in  deploy  time (more  than  100  deploys  per  day) Loose  coupled  design  (HATEOAS  API,   Service  Decomposition),  PubSub Auto  Provisioning (by  docker containerizing) DevOps  CI/CD Scalability   Reusability Multi-­channel  Support Responsive  Web, Chat  Bot Dynamic Service  Composition Dynamic  Discovery/Composition, BPM Usability     Performance Fast  browsing,  Single  Page, DDoS protection,  Inter-­microservice integration Client-­side  UI  rendering,  API  Gateway,   Circuit Breaker,  Event-­driven  Arch. Security For  all services including  3rd-­party  ACL Access  Token,  IAM 73 Loose  coupled  design  (HATEOAS  API,   Service  Decomposition)
  • 78. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 79. Integration Patterns 75 By Request-Response By Event-driven Architecture By UI
  • 80. “ 76 Service Composition with User Interface ▪ Extended Role of Front-end in MSA Architecture: Service Aggregation ▪ Why MVVM? ▪ W3C Web Components Standard – Domain HTML Tags ▪ Implementation: Polymer and VueJS ▪ Another: ReactJS and Angular2 ▪ Micro-service Mashups with Domain Tags: i.e. IBM bluetags ▪ Cross-Origin Resource Sharing ▪ API Gateway (Netflix Zuul) https://www.youtube.com/watch?v=djQh8XKRzRg https://github.com/IBM-­Cloud/bluetag
  • 81. 아마존 닷컴은 다양한 서비스 제공과 효율적인 운영 환경 전환을 위해 분산 서비스 플랫폼으로 전환 하였습니다. 2001년 아마존은 주요한 아키텍쳐 변화가 있었는데 기존 모놀리식(Monolitic)
  • 82.  기반에서 서로 다른 어플리케이션 기능을 제공하는 분산 서비스 플랫폼으로 변화 하였습니다. 현재의 Amazon.com의 첫 화면에 들어 온다면,
  • 83.   그 페이지를 생성하기 위해 100여개가 넘는 서비스를 호출하여 만들고 있습니다.
  • 84. Client-side Rendering : 장애 전파 회피 상품이미지 [주문버튼] 배너 상품추천 다음중 가능한 빨리 로딩되어야 하고, 문제가 없어야 할 화면 영역은? Server-­side  Rendering  은 모든 화면의 콘텐츠가 도달해야만 화면을 보여줄 수 있지만, Client-­ side  Rendering  은 먼저 데이터가 도달한 화면부터 우선적으로 표출할 수 있다. 광고배너가 나가지 못한다고 주문을 안받을 것인가? 그걸 원하지 않는다면 AJAX  /  MVVM  같은 Client-­side  Rendering  기술에 주목하자 1 2 3
  • 85. Microservice Integration with by UI ▪서비스의 통합을 위하여 기존에 Join SQL 등을 사용하지 않고 프론트-엔드 기술이나 API Gateway 를통하여서비스 간 데이터를 통합함 ▪프론트엔드에서 데이터를 통합하기 위한 접근 방법으로는 W3C 의 Web Components 기법과 MVVM 그리고 RESTAPI 전용 스크립트가 유용함
  • 86. W3C Web Components 80 style style  for  A style  for  B style  for  C /style html element  for  A element  for  B element  for  C /html script script  for  A script  for  B script  for  C /script #A.html style style  for  A /style html element  for  A /html script script  for  A /script #B.html style style  for  B /style html element  for  B /html script script  for  B /script #C.html style style  for  C /style html element  for  C /html script script  for  C /script #index.html A  A B  B  B C   ▪ Custom elements ▪ HTML imports ▪ Template ▪ Shadow DOM
  • 88. Frameworks supporting Web Components 82 • Provides  Cohesive  Component   Model • Component   Composition   by  HTML   markup • Dynamic  Data  Binding • Responsive  Web  by  Material   Design • Standard Polymer                             VueJS **  비표준: Angular  JS,  React
  • 89. Custom tag for Domain Class: product tag 83 template div h1Product  Management/h1 product  v-­model=”products[index]  v-­for='(product,  index)  in  products'   @change=updateProduct  @remove=removeProduct   @classes=jumpToProducts/product h2Add  New  Product/h2 product  v-­model=newProduct  editMode=true  isNew=true   @add=addProduct/product /div /template
  • 90. Data binding to Domain Class Tags 84 script var products  =  [];; var me  =  this;; backend.$bind(”products,  products  );; products.$load().then(function(products  ){ me.  products  =  products  ;;  //  set  the  view's  data  with  the  loaded  data  obtained  from  backend. });; /script product  v-­model=”products[index]  v-­for='(product,  index)  in  products'   @change=updateProduct  @remove=removeProduct   @classes=jumpToProducts/product
  • 91. Tenant UI Customization (Composition) by Tag composition 85 Domain  HTML  Tags product order   delivery customer ….   Tenant  A Tenant  B Tenant  C
  • 92. 86 Oops! CORS Exception? Accessing  Multiple   Microservices from   outside
  • 93. 87 API Gateway: Edge Service Acting  like  “Skin”  to  access  our  services  : • Re-­Routes  to  multiple  services • Allows  CORS • Checks  ACLs • Prevent  DDOS  etc.
  • 94. API Gateway: Routing, Securing and Load-balancing 88 Front-­‐End API  GW  (Spring  Gateway) Product Delivery1Order1 EUREKA / Kube-­‐DNS http://abc.com/orders/** http://abc.com/products/** http://abc.com/deliveries/** Order-­service:  ip1,  ip2 Product-­service:  ip3 Delivery-­service:  ip4,  ip5 Order2 Delivery  2 Ip1:port1/orders/** Ip2:port2/orders/** Ip3:port3-­1/products/** Ip4:port4-­1/deliveries/** Ip5:port5-­1/deliveries/** • Add  CORS  Header • Routes  to  actual  backend  service   • Load  Balancing • Fallback Delivery  3 Ip6:port6-­1/deliveries/** By  container  orchestrator  something
  • 95. 89 Configuring Spring Gateway #application.yml spring:    cloud:        gateway:            routes:                -­  id:  product                    uri:  http://product:8080                    predicates:                        -­  Path=/product/**                -­  id:  order                    uri:  http://order:8080                    predicates:                        -­  Path=/order/**                -­  id:  delivery                    uri:  http://delivery:8080                    predicates:                        -­  Path=/deliveries/**
  • 97. 91 OAuth2 Authorization Server implemented by Spring Security • https://github.com/Baeldung/spring-­security-­oauth • https://www.keycloak.org/ • https://github.com/TheOpenCloudEngine/uEngine-­cloud/tree/master/uengine-­cloud-­iam
  • 98. Transaction Problem in UI composition 주문량: 0 재고량: 10 주문량 : 1 재고량 : 10 주문량 : 2 재고량 : 9 주문량 : 3 재고량 : 8 Consistent In-­consistent 조회화면서비스구성 (클라이언트가 순차 호출) Product (MongoDB) Order (MySQL) Client  (Web/Mobile) POST (성공시) -­à POST
  • 99. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 100. “ 94 Service Composition by Request-Reponse ▪ Inter-microservices call requires client-side discovery and load-balancing ▪ Netflix Ribbon and Eureka ▪ Hiding the transportation layer: Spring Feign library and JAX-RS ▪ Circuit Breaker Patterns
  • 101. 서비스의 호출 방식 2가지 ▪ 외부에서 95 마이크로 서비스 간 (inter-­microservice call) HTTPClient 로 REST 호출 혹은 Event  로 pub/sub Feign  을 사용, @Autowired 로 proxy  객체리턴 혹은 MOM  (Apache  Kafka),  Spring  Cloud  Stream Ribbon  이 Eureka  를 통하여 직접 마이크로 서비스가 로드밸런싱된 대상을 선택 AJAX  로 REST 호출 Hybind 를 사용, 자바스크립트객체와 Resource  바인딩 Zuul을 경유하여 Eureka  에서 발견된 path  에 따른 서비스가 라우팅
  • 102. Inter-microservices Call – Request/Response 96 Front-­‐end API  GW  (ZUUL) Product Order Course EUREKA / Kube-­‐DNS Course:  ip1,  ip2 Clazz:  ip3 ScheduleCalendar:  ip4,  ip5 Ribbon  / Envoy   sidecar Zuul을 경유하지 않고 직접 내부 IP   로 접근 getStock()
  • 103. FeignClient 97 -­-­-­-­ url을 기반으로 Kube-­ DNS  를 찾아감 @FeignClient(name  =  ”product”,  url=“http://product:8080”) public  interface  ProductService { @RequestMapping(method   =  RequestMethod.GET,  path=/products/{productId}) Product  getProduct(@PathVariable(”productId)  Long  productId);; }
  • 104. Consumer Code: Order 98 @Entity public  class  Order{ @Autowired ProductService ProductService;; @PrePersist public  void  beforeSave()  { Product  product  =  ProductService.getProduct(getProductId());; if(product.getStock()    getQty()){ throw  new  RuntimeException(”No  Available  stock!  );; } } }
  • 105. Issues in Request-Response model 서비스구성 (Request-­Response,  Sync  호출) Product (MongoDB) Order (MySQL) Client  (Web/Mobile) POST POST Yet  Another  SVC (NoSQL) POST • 성능저하 • 장애전파 • 트랜잭션 처리를 위한 2PC  구현
  • 106. 장애전파 차단: 서킷브레이커 패턴 100 Client Circuit breaker Supplier Connection problem timeouttimeout timeouttimeout trip Circuit  open 장애 감지 시, 차단기 작동(Open) 일시 동안 Fallback으로 서비스 대체 일부 트래픽으로 서비스 정상여부 확인 정상 확인 시, 차단기 해제(Close)
  • 107. “ 101 Service Composition by Event-driven Model ▪ Event-driven Approach ▪ ACID Tx. vs Eventual Tx. ▪ Business Transaction / Compensation (Saga) Pattern
  • 109. Inter-microservice Call - Event Publish / Subscribe (PubSub) 103 Order Delivery Product pub sub Event  Queue  (i.e.  Apache  Kafka) sub주문이 발생함, TV,   홍길동 배송처리완료배송처리함 pub sub 재고수량처리함 상품정보변경됨 pub
  • 110. Event Publisher : Order 104 @Entity public  class  Order  { …   @PostPersist private  void  publishOrderPlaced()  { OrderPlaced orderPlaced =  new  OrderPlaced();; orderPlaced.setOrderId(id);; … kafka.send(orderPlaced);; } }
  • 111. Event Consumer: Delivery 105 @KafkaListener(topics  =  ”shopping) public  void  onOrderPlaced(…)  { Delivery  delivery  =  new  Delivery();; delivery.setOrderId(orderPlaced.getOrderId());; delivery.setDeliveryAddress(orderPlaced.getCustomerAddr());; delivery.setCustomerName(orderPlaced.getCustomerName());; delivery.setDeliveryState(DeliveryStarted.class.getSimpleName());; deliveryRepository.save(delivery);; Kafka.send(new  OrderShippped(delivery));;    //triggers  new  event }
  • 112. Event Consumer: Product 106 @KafkaListener(topics  =  ”shopping) public  void  onOrderShipped(…)  { Product  product  =  productRepository.findById(orderShipped.getProductId());; product.setStock(product.getStock()   – 1);; productRepository.save(product);; }
  • 113. Adding a new service 107 Order Delivery Marketing pub sub Event  Queue  (i.e.  Apache  Kafka) sub주문이 발생함, TV,   홍길동 배송처리완 료 배송처리함 pub sub 홍길동의 선호도 정보 수집함 Product sub sub 재고수량처 리함 상품정보변 경됨 pub New  Service
  • 114. Distributed Transaction Issues 108 Eventual  Transaction  /  compensationAtomic  Transaction  /  2PC
  • 115. Eventual TX를 통한 분산 트랜잭션 처리 주문량: 0 재고량: 10 주문량: 1 재고량: 10 주문량 : 1 재고량: 9 주문량 : 2 재고량: 9 주문량: 2 재고량: 8 Consistent In-­consistent 조회화면서비스구성 (Eventual  TX) Product (MongoDB) Order (MySQL) Kafka OrderPlaced (pub) OrderPlaced (sub) Client  (Web/Mobile) POST
  • 116. 여기서 선택의 길을 만남 • 내 서비스에서 데이터 불일치가얼마나 미션크리티컬한가? • 크리티컬 하다고 응답한다면, 내 서비스의 성능과확장성에비하여 크리티컬 한가? • 성능과 확장성 보다 크리티컬 하다면, 성능과 확장성을 포기할 수 있는가? • 성공한 내 서비스의 경쟁자들은무엇을 포기했는가? • è 강력한 의사결정 필요 (무엇으로 태어날것인가…)
  • 117. Eventual TX – 불일치가 Mission Critical 한 경우 Consistent In-­consistent 조회화면서비스구성 (Eventual  TX) Product (MongoDB) Order (MySQL) Kafka OrderPlaced (pub,  PENDING) OrderPlaced (sub) Client  (Web/Mobile) POST All-­done (pub) All-­done (sub,  CLEAR  PENDING) 주문량: 0 재고량: 10 주문량: 1 재고량: 10  (PENDING) 주문량 : 1 재고량: 9 주문량 : 2 재고량: 9  (PENDING) 주문량: 2 재고량: 8
  • 118. Eventual TX – Rollback (Saga Pattern) 주문량 : 0 재고량 : 10 주문량 : 1 재고량 : 10 (PENDING) 주문량 : 1  재고량 : 9 주문량 : 2 재고량 : 9 (PENDING) 주문량 : 2 재고량 : 8 à 취소됨 Consistent In-­consistent 조회화면서비스구성 (Eventual  TX) Product (MongoDB) Order (MySQL) Kafka OrderPlaced (pub,  PENDING) OrderPlaced (sub) Client  (Web/Mobile) POST All-­done (pub) CANCELLED (sub,  DELETE  or  CANCEL) CANCELLED (pub) If~else 주문량 : 2 재고량 : 9
  • 119. Resources on Sagas ▪ http://eventuate.io/ ▪ https://vladmihalcea.com/how-to-extract-change-data-events- from-mysql-to-kafka-using- debezium/?fbclid=IwAR33Spb4jPBNI6VNHuCxdu_BxpWdz OLzMvbCtHHvJrRmJPfiEoXwM1qWYBs 113
  • 120. “ 114 Data Query (Projection) in MSA ▪ Issues: Existing Join Queries and Performance Issues ▪ Composite Services or GraphQL ▪ Event Sourcing and CQRS
  • 121. 분산서비스에서의 Data Projection Issue 115 Order id  :  3492-­2323 restaurant   :  Ajanta Product id:  3492-­2323 status:   PREPARED Bill id:  343-­45611 orderId :  3492-­2323 status   :  PAID Delivery id:  45-­4545 orderId :  3492-­2323 status   :  ENROUTE eta   :  6  :  25  PM Accounting   ServiceDelivery  ServiceProduct   ServiceOrder  Service application Order status view Order id : 3492-2323 Restaurant : Ajanta Status : En route ETA : 6:25 PM Payment : Paid Order  status frontend OrderDetails findOrder(orderId) Data  from  multiple  services Mobile  device  or  web  application Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
  • 122. Data Projection by UI and HATEOAS 116 Order id  :  3492-­2323 restaurant   :  Ajanta _links:{ ticket:     http://products/3492-­ 2323 delivery:   http://deliveries/45-­ 4545 bill:  http://bills/343-­ 45611 } Product id:  3492-­2323 status:   PREPARED Bill id:  343-­45611 orderId :  3492-­2323 status   :  PAID Delivery id:  45-­4545 orderId :  3492-­2323 status   :  ENROUTE eta   :  6  :  25  PM Accounting   ServiceDelivery  ServiceProduct   Service Order  Service application Order status view Order id : 3492-2323 Restaurant : Ajanta Status : En route ETA : 6:25 PM Payment : Paid Order  status frontend Data  from  multiple  services Mobile  device  or  web  application Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018 1.  Fetch  first 2.  Fetch  second  in  parallel
  • 123. Data Projection by Composite Service or GraphQL 117 Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018 ≪aggregate≫ Charge Accounting   Service ≪aggregate≫ Delivery Delivery  Service ≪aggregate≫ Product Product   Service ≪aggregate≫ Order Order  Service Find  Order Composer GET/orders/ {orderId} GET/product s?  orderId= {orderId} GET/deliveries?   orderId= {orderId} GET/charges?   orderId= {orderId} GET/order/{orderId} Order status view Order id : 3492-2323 Restaurant : Ajanta Status : En route ETA : 6:25 PM Payment : Paid Order  status frontend
  • 124. 생각을 다르게 하자 : CQRS and Event-Sourcing 118 https://justhackem.wordpress.com/2016/09/ 17/what-­is-­cqrs/ https://www.infoq.com/articles/microservice s-­aggregates-­events-­cqrs-­part-­1-­richardson • CQRS 패턴 • 읽기전용 DB와 쓰기 DB를 분리함으로써 Optimistic Locking 구현 • Query 뷰를 다양하게 구성하여 여러 MSA 서비스 목적에 맞추어 각 서비스의 리드모델에 부합 • Polyglot Persistence
  • 125. CQRS 의 확장 : Multiple Event Sources 119 Order  Service Product Service Delivery   Service Accounting   Service My  Page Service My  Page view   database Order Events Product Events Delivery Events Accounting Events findMyHistory(  ) Event handlers (Materialized  View) Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
  • 126. Requirements / Check Category Requirement Solution Maintainability    Scalability 24*365 Zero  Down  time Self-­Healing,  Horizontally  Scale Minimal  Dev-­Ops,  Dev-­Dev  team  side   effects  in  deploy  time (more  than  100  deploys  per  day) Loose  coupled  design  (HATEOAS  API,   Service  Decomposition),  PubSub Auto  Provisioning (by  docker containerizing) DevOps  CI/CD Scalability   Reusability Multi-­channel  Support Responsive  Web, Chat  Bot Dynamic Service  Composition Dynamic  Discovery/Composition, BPM Usability     Performance Fast  browsing,  Single  Page, DDoS protection,  Inter-­microservice integration Client-­side  UI  rendering,  API  Gateway,   Circuit Breaker,  Event-­driven  Arch. Security For  all services including  3rd-­party  ACL Access  Token,  IAM 120
  • 127. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Commerce  Shopping  Mall 2. Architecture  and  Approach  Overview 3. Domain  Analysis  with  DDD  and  Event  Storming 4. Service  Implementation  with  Spring  Boot  and  Netflix  OSS 5. Monolith  to  Microservices 6. Front-­end  Development  in  MSA 7. Service  Composition  with  Request-­Response  and  Event-­driven   8. Implementing  DevOps  Environment  with  Kubernetes, Istio and  Gitlab
  • 128. “ 122 DevOps ▪ DevOps Process and Tools ▪ Deploy Strategies ▪ Containers and Orchestrators ▪ Cloud Foundry, Bluemix, and Kubernetes https://www.youtube.com/watch?v=_I94-­tJlovg
  • 129. Process Change: 열차말고 택시를 타라! 123 모노리식 개발 및 운영환경 • 모노리식 환경하에서는 큰 개발팀이 하나의 소스코드레파지토리에 변경 사항을 커밋하므로 코드간 상호 의존도가 높아 신규 개발 및 변경이 어려움 • 작은 변경에도 전제를 다시 테스트/ 배포하는 구조이므로통합 스케줄에 맞춘 파이프 라인을 적용하기가 어렵고 Delivery 시간이 과다 소요 마이크로서비스 개발 및 운영환경 • 작고 분화된 조직에서 서비스를 작은 크기로 나누어 개발하므로해당 비즈니스 로직에만 집중하게 되어 개발 생산성 향상 • 연관된 마이크로서비스만 테스트를 수행하므로 개발/테스트/배포 일정이 대폭 축소 CI Backlog Manual testing 어플리케이션 Production Deployment  pipeline Source Code repository 큰 개발조직 하나의 코드 레파지토리 코드 커밋에서 테스트, 운영환경 배포과정 힘듬 크고,  복잡,   유지보수가 어려움 서비스 Production Deployment  pipeline Source Code repository 서비스 Deployment  pipeline Source Code repository Automated CI / CD 서비스 Deployment  pipeline Source Code repository 작고,   자율적이며,   느슨한 조직 구조 하나의 서비스가 하나의 레파지토리 각 서비스가 자신의 자동화된 배포 파이프라인을 가짐 작고,  단순,   유지보수가 용이 Automated CI / CD Automated CI / CD Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
  • 130. Process Change: Consumer-driven Test 124 Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018 • MSA 테스트에는 Contract- based Test가 특징적 • API Consumer가 먼저 테스트 작성 • API Provider가 Pull Request 수신 후 테스트는 자동으로 생성됨 • Consumer 측에 Mock 객체가 자동생성 병렬개발이 가능해짐 • Spring Cloud Contract가 이를 제공 • Provider의 일방적인 버전업에 따른 하위 호환성 위배의 원천적 방지 특징 MSA 서비스의 테스트 Maven  repository Contract.make{ Request{..} Response{…} } …Service-­ Order  Service contract  test suite API  gateway Integration  test API  gateway Published contract API  gateway  team Order  Service  team Order Service 2 Code  generated from 1 Writes Tests Develops Tests Develops Publishes 3 Reads 4 • 컨트랙트 테스트는 서비스 수요자가 주도하여 테스트를 작성한다. 수요자가 테스트를 작성하여 제공자의 레포지토리에 Pull-Request 하면, 제공자가 이를 Accept 한후에 제공자측에서 테스트가 생성되어 테스트가 벌어진다.
  • 132. CI/CD Tools – conventional CI/CD 126 ❑ 잦은 배포 ❑ 일반 서버에 배포 ❑ 테스트 자동화/커버리지 ❑ 도구: Jenkins,  Travis,  Gitlab 등
  • 133. CI/CD Tools – Container-based 127 ❑ Immutable  Image ❑ API  Testing ❑ Blue/Green,  Canary ❑ 도구: Jenkins  +  Docker  +  Spinnaker  +  Helm  +  Kubernetes à 매우복잡
  • 134. CI/CD Tools - Serverless 128 ❑ Infrastructure  As  A  Code ❑ Application  Configuration  과 Infra Configuration을 하나의 설정에 통합 ❑ 단일 도구
  • 136. DevOps DevOps Platforms ▪ IBM Bluemix ▪ Heroku ▪ GE’s Predix ▪ Pivotal Web Services • Cloud  Foundry Container Workload  Distribution  Engine (Container  Orchestrator) PaaS • Warden(Garden) • Docker • Kubernetes • Docker  SWARM  (toy) • Mesos Marathon  (DCOS) • Google  Compute  Engine • Redhat Open  Shift • IBM  Bluemix • Amazon  ECS • Hypervisor • CF  version  1 • Engineyard….   • Amazon  Beanstalk
  • 138. Container-based Application Design 132 https://kubernetes.io/blog/2018/03/principles-­of-­container-­app-­design/?fbclid=IwAR2oMrdP0d1Q6LXebtxNPnt-­RS5DIlkCIwpaMSL5mmW7VMaQb6hRV8hkd38
  • 139. Kubernetes Object Model Service (name:  foo) Deployment ReplicaSet (Blue) redirects Creates  /  manages Pod Contai ner (main) Contai ner (side-­ car) Pod Contai ner Contai ner ReplicaSet (Green) Pod Contai ner Contai ner Pod Contai ner Contai ner • Keep  replica  count  as   desired  (replicas=2) • Dynamic  Service  Binding • e.g.  http://foo:8080 • Type: Ø LoadBalancer e.g.  Ingress  (API  GW)  or   front-­end Ø ClusterIP e.g.  내부 마이크로 서비스들 • Zero-­down  time  deployment • (Kubernetes  default  is  rolling-­update) e.g.  Blue  /  Green • Service  Hosting Responsible  for: http://serviceId:8080 http://external_ip:8080   Micro-­Service Load  Balancer   from  cloud   provider
  • 140. Declaration based configuration apiVersion:   apps/v1 kind:  Deployment metadata: name:  nginx-­deployment labels: app:   nginx spec: replicas:  2 … template: metadata: labels: app:   nginx spec: containers: -­ name:  nginx image:  nginx:1.7.9 ports: -­ containerPort:   80 -­-­-­ apiVersion:   apps/v1 kind:  Service metadata: name:  nginx-­service labels: app:   nginx -­-­-­ apiVersion:   apps/v1 kind:  Deployment metadata: name:  backend-­deployment labels: app:   backend spec: replicas:  3 … template: metadata: labels: app:   backend spec: containers: -­ name:  backend image:  backend:latest ports: -­ containerPort:   8080 -­-­-­ apiVersion:   apps/v1 kind:  Service metadata: name:  backend-­service labels: app:   backend -­-­-­ apiVersion:  apps/v1 kind:  Deployment metadata: name:  db-­deployment labels: app:  db spec: replicas:  2 … template: metadata: labels: app:  db spec: containers: -­ name:  db image:  mongo ports: -­ containerPort:  27017 -­-­-­ apiVersion:  apps/v1 kind:  Service metadata: name:  mongo-­service labels: app:  mongo  my-­app.yml  Desired  state
  • 141. Reference MSA Projects ▪ Online Commerce Example: https://github.com/TheOpenCloudEngine/uEngine-cloud/wiki ▪ Commercial Product: uEngine 5 BPMS: https://github.com/uengine-oss/uEngine5-base ▪ CQRS and Spring 2.0: http://www.kennybastani.com/2016/04/event-sourcing-microservices- spring-cloud.html 135
  • 142. THANKS! Any Question? You can find me at: jyjang@uengine.org https://github.com/jinyoung https://github.com/TheOpenCloudEngine 136