SlideShare uma empresa Scribd logo
1 de 253
Baixar para ler offline
Micro Service Architecture
Copyright © 2018. Jinyoung Jang & uEngine-solutions All rights reserved.
강의를 시작하기 전에 - Backchannel
스크립트 복사
자료 공유
의견/질의
강의중 명령모음
URL for sample project
3
https://github.com/uengine-­oss/msa-­tutorial-­class-­management-­monolith
https://github.com/uengine-­oss/msa-­tutorial-­class-­management-­msa
https://github.com/uengine-­oss/msa-­tutorial-­class-­management-­frontend
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Public  Education  Service
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
퍼블릭 에듀케이션 영역 예제
▪모 교육기관의 실질적 강좌강의수강
시스템의 실질 요구사항과 교재 개발에
참여함
▪해당 요구사항은 강좌기획,
강의(클래스)관리, 수강관리 등
서브도메인으로 나뉘어 마이크로서비스
분석 예제로 적합함
▪강의 신청 기간에 특정 서비스가 핫-
스폿으로 요청이 폭주하는 경향은 마이크로
서비스의 Self-Healing, 결함내성, 동적
확장 등의 MSA 설계 강점을 잘 설명할 수
있음
▪챗봇을 통한 강의 수강 신청등의 자동화를
통하여 Dynamically Reconfigurable 한
MSA 수준의 기능을 시연할 수 있음
6
Use cases
7
Courses Enrollment Process
8
Domain Class Model
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Public  Education  Service
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를구성하여 하드웨어, 미들웨어 구성을
직접해야 하는 비용문제.
Speed to digital transformation
SPEED
비즈니스 애플리케이션 개발에 과도하게 소요되는
시간은 분석과 반복적인 중복코드, 운영 단절에
의한 오류 감소로 인한 생산성 극대화와 Time-to-
Market 최소화
Software development is a learning process,
working code is a side effect - Martin Fowler
DevOps: Issues
Continuous Delivery
12
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는얼마나자주 배포할까요?
서비스가 죽지 않으면 어떨까?
13
항상성 (Self-Healing) 이 자동으로
유지되면 어떨까?
14
자원을 최대한 공유할 수 있을까?
15
Continuous Delivery 
Zero Downtime Deployment 가 되면
어떨까?
16
17
2. 배포 주기
• 매일 마이너 업데이트
• 메이저 업데이트 (매주 화요일 오후)
3. Deployment
 Pipeline
출처:  http://ieeexplore.ieee.or g/xpl/artic leDet ails.jsp?arnumber=6449236
Supporting Continuous Delivery
Facebook
18
4. Canary를통해서확신 갖기
• Canary란? 실제production
 환경에서 small
 subset에서새로운코드를 돌려보고 옛날
코드와 비교해서 새로운 코드가어떻게 돌아가는 지 보는 것
• Canary
 분석작업(HTTP
 status
 code,
 response
 time,
 실행수, load
 avg등이옛날 코
드랑 새로운 코드랑 비교해서 어떻게다른 지 확인하는것)은 1000개 이상의metric을
비교해서 100점 만점에 점수를 주고 일정 점수일 경우만배포할 수 있음.
출처: http://techblog.netflix.com/2013/08/deploying-­ netflix-­ api. html
Supporting Continuous Delivery
Netflix
출처 :  2010  architecting  for  the  cloud  (http://www.slideshare.net/simone.brunozzi/2010-­architecting-­for-­the-­cloud-­4719195)
DevOps: Issues
Managing Scalability
Managing Scalability
Workload Distribution Engine
desired=5 desired=5 desired=4
ERP:  1              2          3                            4                                        5
CRM:                                1            2            3                        4            5
BI                                                                            1            2          3            4
Managing Scalability
Workload Distribution Engine
desired=5 desired=5
actual=4
desired=4
actual=3actual=4
Managing Scalability
Workload Distribution Engine
desired=5 desired=5
actual=5
desired=4
actual=5actual=5
Managing Scalability
Workload Distribution Engine
Managing Scalability
Workload Distribution Engine
ERP  v2
SW  router  (HA  proxy,  Envoy,  nginx)
▪IBM Bluemix
▪Heroku
▪GE’s Predix
▪Pivotal Web Services
• Cloud  Foundry
Container
Workload  Distribution  
Engine  (OSS)
PaaS
• Warden(Garden)
• Docker • Kubernetes
• Docker  SWARM
• Mesos DC/OS
• Google  Compute  Engine  (GKE)
• AWS  EKS
• Azure,  Alibaba
• Redhat Open  Shift
• Hypervisor • CF  version  1
• Engineyard….  
• Amazon  Beanstalk
DevOps
DevOps  Platforms
Top 9 Rules for Cloud Applications (IBM)
26
1
1. Don't  code  your  application  directly  to  a  specific  topology
2. Don't  assume  the  local  file  system  is  permanent
3. Don't  keep  session  state  in  your  application
4. Don't  log  to  the  file  system
5. Don't  assume  any  specific  infrastructure  dependency
6. Don't  use  infrastructure  APIs  from  within  your  application
7. Don't  use  obscure  protocols
8. Don't  rely  on  OS-­specific  features
9. Don't  manually  install  your  application
DevOps Platform
IBM Bluemix
DevOps Platform
IBM Bluemix – Auto Scaling
DevOps  Platform
IBM  Bluemix – Zero  Downtime  
Deploy
사례: Amazon.com
▪수 천개의 팀 그리고 Autonomy
▪마이크로 서비스
▪지속적 배포
▪다양한 플랫폼 (폴리글롯)
▪== 연간 5천만회 배포
▪시간당 5078회 또는 0.63초당 1회
▪자동화된 DevOps 환경 없이는
운영불가
Monolithic Architecture
à 모든 서비스가 한번에 재배포
à 한팀의 반영을 위하여 모든 팀이 대기
à 지속적 딜리버리가 어려워
Micro Service Architecture
Contract based, Polyglot Programming
à Separation of Concerns, Parallel Development, Easy Outsourcing
Written  in  Java
Written  in  Node
Written  in  PHP
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.
33
프론트엔드
데이터베이스
재무 생산 인사
프론트엔드
데이
터베
이스
재무
데이
터베
이스
생산
데이
터베
이스
인사
모놀리씩 마이크로서비스
적용효과
효과 – 장애 최소화
프론트엔드
데이터베이스
재무 생산 인사
프론트엔드
데이
터베
이스
재무
데이
터베
이스
생산
데이
터베
이스
인사
장애가 전파되며, 수동 복구로 장애지연 장애가 격리되며, 자동으로복구됨(이전버전)
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 최소화
▪자율성
à 각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이
▪병렬 개발, 타임 투 마켓, 린 개발
Netflix
넷플릭스는 수백개의마이크로서비스를운영하고있는 것으로유명하다. 각
마이크로서비스간에는 REST  방식의호출을 통하여 연동되며 이들간의 자동화된 식별과 동적
연동을 위하여 자체적인 플랫폼을 구축했고 이를Netflix  OSS  라는 이름으로오픈소스화 하였다.
AWS 기반 마이크로 서비스 전환
사례
Gaming  Platform
Mobile  Apps  and
Serverless Microservices
IoT Service
Serverless Microservices
From  Monolithic  to
Microservices
Pure  Play  Video  OTT-­ A
Video    Broadcasting
▪가장 작고 독립적인 서비스로 부터
마이그래이션
▪순차적 레거시의 마이크로서비스 전환을
위한 API GW 적용한 “스트랭글러 패턴”
적용
▪서비스 폴백 테스트 및 자동화가 필수 조건
▪새로 추가/변경 필요한기능부터분리
▫안정된 레거시는 가능한 손대지 않음
▫적은 리스크 업무 영역부터
▫기술보다 노하우와 팀의 문화 정립 우선시
▪Business Domain 단위 서비스구성
▫팀단위 분리 X, 기술적 단위 분리X
▫비즈니스 서브 도메인 단위로의구성
à Separation ofConcerns
▫응집도
▪서비스 존재 목적은 재사용되어지는 것
▫표준화된 API I/F
▫자동화된 문서화
45 Source:   pwc
MSA Trade-offs (from Martin Fowler)
46
47
Conclusion
▪MSA 는 성공적인 SaaS 의 디자인 패턴:
▪Back-end API 설계가 중요
▫ REST MM Level 3 – HATEOAS
▫ Aggregation of data from multi micro-services
▪MSA 를 적용하려면 작은 단위의 배포를 위한
운영 자동화 환경이 제공되어야 함
▫ Container Orchestrator
▫ DevOps Platform
48
1.
Architecture and approaches
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,  IAM50
10 Attributes of Cloud Native Applications
51
1. Packaged  as  lightweight  containers
2. Developed  with  best-­of-­breed  languages  and  frameworks
3. Designed  as  loosely  coupled  microservices
4. Centered  around  APIs  for  interaction  and  collaboration
5. Architected  with  a  clean  separation  of  stateless  and  stateful services
6. Isolated  from  server  and  operating  system  dependencies
7. Deployed  on  self-­service,  elastic,  cloud  infrastructure
8. Managed  through  agile  DevOps  processes
9. Automated  capabilities
10. Defined,  policy-­driven  resource  allocation
https://thenewstack.io/10-­key-­attributes-­of-­cloud-­native-­applications/
52
Architecture Overview
Develop  
Courses
Schedule
Courses
Book  
Classes
Course Class Customer
Deployment - MSA
53
• Dynamic  Discovery  /  Binding
• Self  Healing  /  Auto  Fail-­over
• Load  balancing  /  Cluster
Course Class
Cloud  Infra
Container  /  Orchestrator
External
Dependency  
Services
Approaches
54
Miroservice
Patterns
Event-­
driven
Architecture
Container-­
based  
Deployment
55
Approach #1: MSA Patterns
Tools covering Microservices: 2000s
56
BPEL4WS
Netflix OSS 와 Spring Cloud 의 등장
넷플릭스는 수백개의마이크로서비스를운영하고있는 것으로유명하다. 각
마이크로서비스간에는 REST  방식의호출을 통하여 연동되며 이들간의 자동화된 식별과 동적
연동을 위하여 자체적인 플랫폼을 구축했고 이를Netflix  OSS  라는 이름으로오픈소스화 하였다.
Tools covering Microservices: 2010s
58
Tools: Evolution of Module Systems
59
Java  Module  System Hypervisors Containers
Approach #2: Container-based Deployment
Approach #2: Container-based Deployment
60 https://kubernetes.io/blog/2018/03/principles-­of-­container-­app-­design/?fbclid=IwAR2oMrdP0d1Q6LXebtxNPnt-­RS5DIlkCIwpaMSL5mmW7VMaQb6hRV8hkd38
Approach #3: 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 #3: Event Driven Architecture
Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­with-­event-­
storming-­73c6236f5dd7,  Kevin  webber
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Public  Education  Service
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 과 컨텍스트 맵: 보편언어, 바운디드 컨텍스트 식별
65
DDD Pattern Applied
DDD: Domain Object Classifications
66
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
How to implement (if green-field)
• Event  à Event  Domain  Class  by  Java
• Aggregate  à Cluster  of  JPA  Entities
• Command  à Spring  Data  Rest  will  generates  the  
REST-­based  Services
• Policy  à JPA  Entity’s  Lifecycle  Hook  or  CDC
• Document  à Polyglot  Data  Model
How to implement (if brown-field)
• Events  Extracted  from  Legacy  Systems
• Lifecycle  Hook  or  CDC
• New  Service  subscribing  the  key  events
• New  functions  are  coded  in  new  service
Lab Time – Event 들을 먼저 도출
과정이등록됨 강의가등록됨
강사가매핑됨
수강이신청됨
강의일정변경
됨
강의가 취소됨
수강승인됨
지불요청됨
우리 서비스에는 어떤 비즈니스이벤트들이 발생하는가?
현업이 사용하는 용어를 그대로사용 (Ubiquitous  Language)
용어의 namespace  를 구지 나누려는노력을하지 않음
Lab Time – Policy 도출
과정이등록됨 강의가등록됨
강사가매핑됨
수강이신청됨
강의일정변경
됨
강의가 취소됨
수강승인됨
지불요청됨
어떤 이벤트에 이어서 곧바로 항상 발생해야하는 업무규칙
구현상에서는 이벤트의 Publish에 따라 벌어지는 이후의프로세스가자동으로트리거 되게 함
축하메시
지발송
강사달력
에 추가
취소
안내메일
발송
변경
안내메일
발송
Lab Time – Command 도출 (쓰기행위)
과정정보
입력
강의정보
입력
강사매핑
수강정보
등록
일정변경
Event를 발생시키는 명령은무엇인가? UI를 통해?  or  시간도래? or  다른 이벤트에 의해?
Command  는 어떠한 상태의 변화를 일으키는서비스를 말함.
*  Command 라는 용어는 CQRS  에서 유래했으며, 쓰기서비스인Command  와 읽기행위인Query는구분됨.
강의취소
과정이등록됨 강의가등록됨
강사가매핑됨
수강이신청됨
강의일정변경
됨
강의가 취소됨
수강승인됨
지불요청됨
축하메시
지발송
강사달력
에 추가
취소
안내메일
발송
변경
안내메일
발송
Lab Time – Aggregate 도출 (데이터모델)
도메인 이벤트가 발생하는데는, 어떠한 도메인 객체의변화가 발생했기 때문이다.
하나의 ACID  한 트랜잭션에 묶여 변화되어야 할 객체의묶음을 도출하고,그것들을커맨드, 이벤트와함께 묶는다.
수강승
인
과정정
보입력
강의정
보
입력
강사매
핑
수강신
청
일정변
경
강의취
소
강의가등록
됨
수강이신청
됨
강의일정변
경됨
강의가
취소됨
수강승인됨
지불요청됨
강사가매핑
됨
과정이등록
됨
강의
(Clazz)
과정
(Course)
수강
(Enrollment)
축하메
시지발
송
강사
달력
에
추가
취소
안내메
일 발송
변경
안내메
일 발송
일정추
가
일정이
추가됨
일정
노티발
송
노티이력
Lab Time – Bounded Context 도출
수강승
인
과정정
보입력
강의정
보
입력
강사매
핑
수강신
청
일정변
경
강의취
소
강의가등록
됨
수강이신청
됨
강의일정변
경됨
강의가
취소됨
수강승인됨
지불요청됨
강사가매핑
됨
과정이등록
됨
강의
(Clazz)
과정
(Course)
수강
(Enrollment)
축하메
시지발
송
강사
달력
에
추가
취소
안내메
일 발송
변경
안내메
일 발송
일정추
가
일정이
추가됨
일정
노티 노티이력
개념적:
• Bounded  Context  는 동일한 문맥으로 효율적으로 업무 용어 (도메인 클래스)를 사용할 수 있는 객체범위를 뜻한다. 하나의 BC  는 하나이상의 어그리게잇을
원소로 구성될 수 있다. BC를 Microservice 구성단위로 정하게 되면 이를 담당한 팀 내의 커뮤니케이션이 효율화된다.
구현관점:
• 어그리게잇은 ACID  트랜잭션 범위이기도 하기때문에 이를 더 쪼개서 BC  를 구성할 수는 없다. BC  내의 어그리게잇들에 대한 보존 (Persistence)은 아마도 그
목적에 맞는 최적화된 데이터모델을 독립적으로 설계하고 구현할 수 있다.
과정개발 강의관리 달력
마케팅
수강관리
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Public  Education  Service
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
81
비즈니스 로직
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
82
▪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
83
Step 1: Applying Hexagonal Architecture
과정정보입
력
과정이등록됨
과정
(Course)
  domain  model
과정개발
과정 (Course)
Message
consumer
Message
producer
DAO
ControllerBrowser
Message  broker
과정정보
입력
과정이
등록됨
Repository
interface
커맨드
외부
도메인이벤트
도메인이벤트
Database
Step 2: Applying MSA Chassis
  MSA  chassis  
Spring  Boot  /  Cloud
과정 (Course)
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
MSA Chassis : Spring Boot  Spring Cloud
86
Well-­designed  MSADDD
Applying MSA Chassis
Spring Boot: A MSA Chassis
87
• 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
88
Go  to  start.spring.io
Set  metadata:
-­ Group:  com.education
-­ Artifact:  education
-­ 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
89
$ 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
90
$ 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  Clazz{
@Id
@GeneratedValue
Long  id;;
String  states;;
int evaluationRate;;
String  title;;
@ManyToOne @JoinColumn(name=cid)
Course  course;;
}
@Entity
public  class   Course   {
@Id
@GeneratedValue
Long   id;;
String  title;;
int duration;;
String  description;;
int maxEnrollment;;
int minEnrollment;;
Double   unitPrice;;
@OneToMany(   cascade   =  CascadeType.ALL,  
fetch   =  FetchType.EAGER,   mappedBy =  course)
ListClazz  clazzes;;
}
@Entity
public  class  Enrollment  {
@Id
@GeneratedValue
Long  id;;
@OneToOne
Customer  customer;;
}
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   SharedCalendarService {
@RequestMapping(method   =  RequestMethod.GET,   path=/calendar/{instructorId}/{date})
Resources   getSchedules(@PathVariable(instructorId)   Long   instructorId,  
@PathVariable(date)   String  date);;
}
public  interface   CourseRepository extends   PagingAndSortingRepositoryCourse,   Long   {
ListCourse  findByTitleContaining(@Param(title)   String  title);;
}
과정정보
C.R.U.D
강의정보
C.R.U.D
강사매핑
수강정보
C.R.U.D
일정변경수강취소
….  등등등
지불 축하메시
지발송
Main Class
93
@SpringBootApplication
public  class  Application
public  static  void  main(String[]  args)  {
SpringApplication.run(Application.class,  args);;
}
}
Test Generated Services
94
$ http localhost:8080
{
_links: {
clazzDays: {
href: http://localhost:8080/clazzDays{?page,size,sort},
templated: true
},
clazzes: {
href: http://localhost:8080/clazzes{?page,size,sort},
templated: true
},
courses: {
href: http://localhost:8080/courses{?page,size,sort},
templated: true
},
customers: {
href: http://localhost:8080/customers{?page,size,sort},
templated: true
},
instructors: {
href: http://localhost:8080/instructors{?page,size,sort},
templated: true
} }
}
HATEOAS  links
Create new course
95
$ http localhost:8080/courses title=SOA duration=5 maxEnrollment=50
minEnrollment=10
{
_links: {
self: {
href: http://localhost:8080/courses/1
}
},
courseId: null,
description: null,
duration: 5,
maxEnrollment: 5,
minEnrollment: 1,
title: SOA
}
URI  of  the  new  course
Create a class of the course
96
$ http POST class-service:8080/clazzes date=“2018-12-5”
course=http://course-service:8080/courses/1
$ http http://localhost:8080/courses/1/clazzes
URI  of  the  SOA  course
{
_embedded: {
clazzes: [
{
_links: {
self: {
href: http://localhost:8080/clazzes/2
}
},
evaluationRate: 0,
states: null
}
]
},
Course  is  aggregation  root
Mapping an instructor to the class
97
$ http http://localhost:8080/instructors firstName=진영 lastName=장” # 강사 등록
$ http http://localhost:8080/clazzDays clazz=http://localhost:8080/clazzes/3
date=2012-04-23T18:25:43.511Z” # 클래스의 일정 등록
# 다른 클래스 하나 더 생성
$ http localhost:8080/clazzes course=http://localhost:8080/courses/1
$ http http://localhost:8080/clazzDays clazz=http://localhost:8080/clazzes/5
date=2012-04-23T18:25:43.511Z” # 일정이 중복되는 강의로
Mapping an instructor to the class
98
$ http PATCH http://localhost:8080/clazzes/3
instructor=http://localhost:8080/instructors/2 # 장진영 강사에게 첫
클래스를 지정
$ http PATCH http://localhost:8080/clazzes/5
instructor=http://localhost:8080/instructors/2 # 두번째 클래스는 같은
날에 있기 때문에 장진영 강사 일정이 중복되어 오류가 날 것.
$ http http://localhost:8080/instructors firstName=상철 lastName=황”
# 강사 2 등록
$ http PATCH http://localhost:8080/clazzes/5
instructor=http://localhost:8080/instructors/8 # 이 요청은 성공 해야 함.
황상철 강사는 일정이 가능하기 때문에...
Enroll in the class and approve the enrollment
99
$ http localhost:8080/customers firstName=진영 lastName=장 #수강생 회원 등록
$ http localhost:8080/enrollments clazz=http://localhost:8080/clazzes/2
customer=http://localhost:8080/customers/3 #수강 예약
$ http http://localhost:8080/customers/3/enrollments #수강 목록 조회
$ http PATCH http://localhost:8080/enrollments/4 status=approved #수강 승인
Not applicable to Entity / Repository ?
use “Service”
▪ For Shared Calendar Service, this is not en entity
▪ In this case, we introduce ‘Service’
▪ Define interface first by using JAX-RS (contract)
▪ Uses return type as “ResourceSupport” for HATEOAS link and loose
coupling
100
Create a Service Interface
101
public  interface  SharedCalendarService {
@RequestMapping(
method  =  RequestMethod.GET,
path=/instructors/{instructorId}/schedule/{date}”
)
ResourceSupport getSchedules(
@PathVariable(instructorId)  Long  instructorId,  
@PathVariable(dateStr)  String  dateStr
);;
}
Create a Service Implementation
102
@Component
public  class  SharedCalendarServiceImpl implements  SharedCalendarService {
@Autowired
ScheduleRepository scheduleRepository;;
@Override
public  ResourceSupportgetSchedules(Long  instructorId,  String  dateStr)  {
ListSchedule  schedules  =  scheduleRepository.findByInstructorIdAndDate(instructorId,  date);;
return  new  ScheduleResource(schedules);;
}
}
Tip: Embedding HATEOAS links
103
If(clazz.getStatus().equals(OPEN))
add(
linkTo(
methodOn(EnrollService.class).enroll(clazz.getId())
).withRel(”enroll)
);;
{
…
_links:  {
”enroll”:{“href”:  “http://localhost:8080/clazzes/1/enroll”}
})
);;
Code:  
https://github.com/TheOpenCloudEngine/uEngine5-­
base/blob/master/process-­
service/src/main/java/org/uengine/five/service/InstanceResource.java
104
{
_links: {
“enrollIn: {
href: http://localhost:9992/clazzes/2/enroll
},
clazz: {
href: http://localhost:9992/clazzes/2
},
clazzDays: {
href: http://localhost:9992/clazzes/2/clazzDays
},
course: {
href: http://localhost:9992/clazzes/2/course
},
instructor: {
href: http://localhost:9992/clazzes/2/instructor
},
self: {
href: http://localhost:9992/clazzes/2
}
},
evaluationRate: 0,
states: wait-for-instructor
}
Monolothic 에서의 분산 트랜잭션 – 이슈없음
총수강신청시간: 500 총마일리지: 5
총수강신청시간 : 600 총마일리지: 6
Consistent
In-­consistent
조회화면서비스구성 (모놀로씩)
Clazz
(MySQL)
Client  (Web/Mobile)
POST
Enrollm
ent
Mileage
총수강신청시간 : 700 총마일리지: 7
Nice but Too big (monolith)
106
JPA
HATEOAS   API
/courses/*
/clazzes/*
/instructors/*
Service   Object
Generated   by  Spring
Repositories:
CourseRepository
ClazzRepository
InstructorRepository
H2
Entity
Course
Entity
Clazz
Entity
Instructor
Entity
Schedule
Entity
Notification
Entity
Enrollment
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,  IAM107
HATEOAS  API
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Public  Education  Service
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
109
https://github.com/jinyoung/software-­modeling-­class-­management-­monolith
à
https://github.com/jinyoung/software-­modeling-­class-­management-­msa
5개의 눈금: 어느 굵기로 쪼갤 것인가?
그것이 문제로다…
110
Aggregate monolithminiBounded  context Business  Capability
최소 사이즈 –
ACID  가
준수되어야 하는
원자적 단위
-­ 유연성이 높은
커뮤니케이션이
원활한 단위 –
Separation  of  
Concerns  이 좋은
비즈니스적 성과
측정과 피버팅이
용이한 단위 –
팀단위와
연결하기 좋은
구현이 용이한
단위
-­ 점진적 MSA  
전환이 용이한
단위
데이터베이스를 어떻게 쪼갤 것인가?
그것도 문제로다…
111
DDD Pattern Applied
112
A Case:
A Sub-domain = A Microservice = A Spring Boot App
113
Source:
Alpha  Code:  https://www.youtube.com/channel/UCmbnw2hZFf6JzWICZIPe9cg
Example of Context Map
▪ U: Up-stream
▪ D: Down-stream
▪ AR: Aggregation Root
114
Lab Time – 마이크로서비스 도출
수강승
인
과정정
보입력 강의정
보
입력
강사매
핑
수강신
청
일정변
경
강의취
소
강의가등록
됨
수강이신청
됨
강의일정변
경됨
강의가
취소됨
수강승인됨
지불요청됨
강사가매핑
됨과정이등록
됨
강의
(Clazz)
과정
(Course)
수강
(Enrollment)
축하메
시지발
송
강사
달력
에
추가
취소
안내메
일 발송
변경
안내메
일 발송
일정추
가
일정이
추가됨
일정
메일 메일로그
강의관리 BC  와 수강관리 BC를 하나의 Micro-­Service  로 통합한 이유?
• 강의 관리와 수강관리는 업무적으로 밀접하고 데이터 참조 관계가 깊다
• 아직까지 이 둘을 나눌 필요가 생길 수준으로 업무적/조직적 간섭이 크지 않다.
과정개발 강의/수강 관리 달력
마케팅
강의관리 수강관리
Lab Time – Context Map 도출
개념적:
• BC  간의 정보참조의 릴레이션, 혹은 이벤트가 발생한 이후의 동반된 행위의 호출의 관계를 선으로 표시함. Upstream  à Downstream  으로 정보가 내려가게 됨.
구현관점:
• 자치적으로 구현설계가 이루어질 수 있는 BC  간에 커뮤니케이션을 위해서는 데이터의 적절한 변환이나 표준화, Pub/Sub  등의 커뮤니케이션 방법 및 데이터
전환에 대한 이슈가 발생하게 됨. 해당 이슈를 적절한 패턴을 선택하여 실제 연동을 위한 Adapter  를 개발해야 함.
수강승인
과정정보입
력
강의정보
입력
강사매핑
수강신청
일정변경
강의취소
강의가등록됨
수강이신청됨
강의일정변경됨
강의가 취소됨
수강승인됨
지불요청됨
강사가매핑됨
과정이등록됨
강의
(Clazz)
과정
(Course)
수강
(Enrollmen
t)
축하메시지
발송
강사
달력
에
추가
취소
안내메일
발송
변경
안내메일
발송
일정이
추가됨
일정
메일로그
과정개발 강의수강관리 달력
U
D
Customer/Supplier  +  Sync
Anti-­corruption  Layer  +  Mediator
일정추
가
Conformist  +  Choreography
Legend:
마케팅
Lab Time – Topology Consideration
:
강의
정보
입력
강사
매핑
일정
변경
강의
취소
강의가
등록됨
강의일
정변경
됨
강의가
취소됨
강사가
매핑됨
강의
(Clazz)
강사
달력
에
추가
취소
안내
메일
발송
변경
안내메일
발송
일정이
추가됨
일정
메일로
그
강의관리 달력
라이락 스티커 (Policy)  를 어디에 둘 것인가?
-­ Orchestration  or  Choreography?  Or  Mediation?
강의
정보
입력
강사
매핑
일정
변경
강의
취소
강의가
등록됨
강의일
정변경
됨
강의가
취소됨
강사가
매핑됨
강의
(Clazz)
일정이
추가됨
일정
메일로
그
강의관리 달력
축하
메시
지발
송
강사
달력
에
추가
취소
안내
메일
발송
변경
안내
메일
발송
일정
추가
메일
발송
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
마케팅 마케팅
Ref: Relation types between services
118
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
Course
(Mongo  DB)
Marketing
(File  Sys)
Class
(H2)
SME
(RDB)
Calendar
(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
Course
Ent it y
Clazz Ent it y
Instructor
Ent it y
Schedule
Ent it y
Notification
Ent it y
Enrollment
Ent it y
YetAnother…
REST  API
REST  API
API  Gateway
강 결합된 객체
참조 구조
Ent it y
Topic
Project Structure – Capstone Project
120
modules
moduleshared-­model/module
!-­-­ core  domain  -­-­
modulecourse/module
moduleclazz/module
modulecustomer/module
!-­-­ supportive  domain  -­-­
modulecustomer/module
modulecalendar/module
!-­-­ general  services  -­-­
moduleproxy-­service/module
moduleregistry-­service/module
/modules
Getting Code:
$ git clone https://github.com/uengine-oss/msa-
tutorial-class-management-msa.git
Solutions – 객체의 분리
121
• 참조해야 할 도메인 클래스들의 공통화
à Shared  Kernel,  Maven  Repo  등을 통한 공통 모델의 공유
: 동일 언어인 경우 유리, 디펜던시 발생
à 혹은 중복 모델 개발 : Polyglot  인 경우 유리
• Entity  분리에 따른 원격 객체 (어그리게잇) 참조
à Primary  Key  를 통해서만 참조
à HATEOAS  link  를 이용
Solutions – API 통합
122
• API  Gateway  
à 진입점의 통일
à Path-­based  Routing  (기존에 REST  로 된경우 가능)
• Service  Registry
à API  Gateway  가 클러스터 내의 인스턴스를 찾아가는 맵
Solutions – 이벤트의 퍼블리시
123
• 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
124
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
마이크로 서비스간의 서열과 역학관계
125
1순위: Core  Domain
버릴 수 없는. 이 기능이 제공되지 않으면 회사가 망하는.
예) 쇼핑몰 시스템에서 주문, 카탈로그 서비스 등
2순위: Supportive  Domain
기업의 핵심 경쟁력이 아닌, 직접 운영해도 좋지만 상황에 따라
아웃소싱 가능한. 시스템 리소스가 모자라면 외부서비스를
빌려쓰는 것을 고려할만한
예) 재고관리, 배송, 회원관리 서비스 등
3순위: General  Domain
SaaS  등을 사용하는게 더 저렴한, 기업 경쟁력과는 완전 무관한
예) 결재, 빌링 서비스 등
무엇을 우선적으로 챙길 것인가?
마이크로 서비스간의 서열과 역학관계
126
어느 마이크로 서비스의 인터페이스를 더 중요하게 관리할 것인가?
카탈로그
(core)
배송 SaaS
(general,  외부서비스)
상품추천
(supportive)
Core  Domain  간 (높은 서열끼리) 에는 Shared-­kernel  도 허용가능하다. 하지만, 중요도가
낮은 서비스를 위해 높은서열의 서비스가 인터페이스를 맞추는 경우는 없을 것이다.
conformist
Anti-­corruption
주문
(core)
Shared-­kernel
마이크로 서비스간의 서열과 역학관계
127
마이크로서비스간 트랜잭션의 묶음을 어떻게 할 것인가?
재고
(core)
배송
상품추천
(supportive)
배송기사가 없다고 주문을 안받을 것인가?
상품 추천이 안된다고 주문버튼을 안보여줄 것인가?
Core  Domain  간에는 강결합이 요구되는 경우가 생길 수 있다. 하지만 우선순위가 떨어지는 비즈니스
기능을 위해 강한 트랜잭션을 연결할 이유는 하등에 없다.
UI  mashup
Async
Event-­driven
Eventual  TX
주문
(core)
ACID  TX
(2PC)
마이크로 서비스간의 서열과 역학관계
128
손님이 많이 와서 집이 좁아졌다.. 무엇을 우선적으로 줄일 것인가?
주문 주문 배송
배송
상품
추천
주문 주문 주문
주문
상품
추천
배송서비스는 야간에 올라와서 후에 처리되어도 된다. 하지만
구매가 몰려드는 시간에 주문을 못받으면 배송은 의미가 없다
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,  IAM129
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  Public  Education  Service
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
131
By Request-Response
By Event-driven
Architecture
By UI
“
132
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
136
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
137
Frameworks supporting Web Components
138
• Provides  Cohesive  Component   Model
• Component   Composition   by  HTML  
markup
• Dynamic  Data  Binding
• Responsive  Web  by  Material   Design
• Standard
Polymer                             VueJS
**  비표준: Angular  JS,  React
User Interface Design
139
Responsive  Web
Material  Design
Custom tag for Domain Class: course tag
140
template
div
h1Course  Management/h1
course  v-­model=courses[index]  v-­for='(course,  index)  in  courses'  
@change=updateCourse  @remove=removeCourse  
@classes=jumpToClasses/course
h2Add  New  Course/h2
course  v-­model=newCourse  editMode=true  isNew=true  
@add=addCourse/course
/div
/template
Custom Tag for Domain Class: class tag
141
template
div
h1Class  Management/h1
clazz v-­model=clazzes[index]  v-­for='(clazz,  index)  in  clazzes'  
@remove=removeClazz/clazz
clazz v-­model=newClazz  editMode=true  isNew=true  @add=addClazz/clazz
/div
/template
Data binding to Domain Class Tags
142
script
var courses  =  [];;
var me  =  this;;
backend.$bind(courses,  courses);;
courses.$load().then(function(courses){
me.courses =  courses;;  //  set  the  view's  data  with  the  loaded  data  obtained  from  backend.
});;
/script
course  v-­model=courses[index]  v-­for='(course,  index)  in  courses'  
@change=updateCourse  @remove=removeCourse  
@classes=jumpToClasses/course
Tenant UI Customization (Composition) by
Tag composition
143
Domain  HTML  Tags
clazz
course  
instructor
clazz-­day
….  
Tenant  A
Tenant  B
Tenant  C
144
Oops! CORS Exception?
Accessing  Multiple  
Microservices from  
outside
145
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
146
Front-­‐End
API	
  GW	
  (ZUUL / Ingress)
Clazz SME	
  1Course	
  1
EUREKA
/
Kube-­‐DNS
http://abc.com/courses/** http://abc.com/clazzes/** http://abc.com/instructors/**
Course-­service:  ip1,  ip2
Clazz-­service:  ip3
Sme-­service:  ip4,  ip5
Course	
  2 SME	
  2
Ip1:port1/instructors/** Ip2:port2/instructors/**
Ip3:port3-­1/clazzes/**
Ip4:port4-­1/smes/**
Ip5:port5-­1/smes/**
• Add  CORS  Header
• Routes  to  actual  backend  service  
• Load  Balancing
• Fallback
SME	
  3 Ip6:port6-­1/smes/**
By  container  orchestrator  something
147
Configuring Netflix Zuul
#application.yml (eureka)
zuul:
routes:
courses:
path:  /courses/**
serviceId:  course
stripPrefix:  false
clazzes:
path:  /clazzes/**
serviceId:  clazz
stripPrefix:  false
#application.yml (kube-­DNS)
zuul:
routes:
courses:
path:  /courses/**
url:  http://class-­course:8080
stripPrefix:  false
clazzes:
path:  /clazzes/**
url:  http://class-­clazz:8080
stripPrefix:  false
Service Registration: EUREKA
148
Microservice registration configuration
149
#application.yml
spring:
application:
name:  clazz
eureka:
client:
serviceUrl:
defaultZone:  http://localhost:8761/eureka/
healthcheck:
enabled:  true
Who  Am  I
부트업 되면서 출생신고할
동사무소(유레카)주소
Marking Self-registration
150
@SpringCloudApplication
@EnableEurekaClient
public  class  Application   {
public  static  void  main(String[]  args)  {
SpringApplication.run(Application.class,   args);;
}
}
Running an Eureka server
151
@SpringBootApplication
@EnableEurekaServer
public  class  RegistryServiceApplication {
public  static  void  main(String[]  args)  {
….
}
}
#application.yml
server:
port:  8761
eureka:
instance:
hostname:  localhost
client:
registerWithEureka:  false
fetchRegistry:  false
serviceUrl:
defaultZone:  
http://${eureka.instance.hostname}:${server.port}/eureka/
Running Registry and Proxy
152
1.  가장 먼저 실행할 것은 Registry  (Eureka  서버)임. [동사무소]
2.  다음으로 실행할 것은 Proxy  (Zuul서버) 임. [이정표 서비스]
$ cd uengine-proxy-server/
$ mvn spring-boot:run
$ cd uengine-registry-server/
$ mvn spring-boot:run
Running Micro Services in local machine
153
2.  Run  and  test  Class  Service
1.  Run  and  test  Course  Service
$ cd clazz-service/
$ mvn spring-boot:run –Dserver.port=8088
Launch another shell and confirm server is up:
$ http localhost:8088/clazzes
$ cd course-service/
$ mvn spring-boot:run –Dserver.port=8089
Launch another shell and check the server is up:
$ http localhost:8089/courses
Authenticating Microservices
154
Front-­‐end	
  or	
  3rd
-­‐party	
  Apps
API	
  GW	
  (ZUUL)
Clazz SMECourse
EUREKA
/courses/** /clazzes/** /instructors/**
IAM
(Oauth
token	
  
provider)
1
2
3
• Request  Access  Token  with  
Permission   scopes
• Acquire  Access  Token  
• Request  with  Token  (Header)
• API  Gateway  validates   the  token
• Easy  and  integrated   way  to  provide  
APIs  for  3rd Party  Apps  
Stateless  한 인증 정보 관리
Memory  사용 최적
Id/pwd
Token   의 발행:
• User:  장진영
• Scopes: 강의서비스
CRUD,  과정서비스 R
장진영 유저가 강좌 서비스에 CUD  메서드
호출시, API  GW  에서 Method   Not  Allowed  
오류 출력
155
Zuul API Gateway for Security
▪ Authorizing Microservices with OAuth2 and PreFilter of Zuul
zuul:
routes:
courses:
path:  /courses/**
serviceId:  course-­service
stripPrefix:  false
iam-­scopes:
-­ course-­access/GET
-­ course-­manage/PUT-­POST-­PATCH-­DELETE
https://github.com/TheOpenCloudEngine/uEngine-­
cloud/blob/master/uengine-­cloud-­
zuul/src/main/java/org/uengine/zuul/pre/IAMFilter.java
156
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
157
Exposing New APIs
▪ Exposing New API from existing microservices
▪ For more complicated services, BPM can be another option
zuul:
routes:
courses:
path:  /courses/**
serviceId:  course-­service
stripPrefix:  false
iam-­scopes:
-­ catalog-­access/GET
-­ catalog-­manage/POST-­PATCH-­DELETE
Transaction Problem in UI composition
총수강신청시간 : 500 총마일리지: 5
총수강신청시간 : 600 총마일리지: 5
총수강신청시간 : 600 총마일리지: 6
총수강신청시간 : 700 총마일리지: 6
Consistent
In-­consistent
조회화면서비스구성 (클라이언트가 순차 호출)
Mileage
(MongoDB)
Clazz
(MySQL)
Client  (Web/Mobile)
POST (성공시) -­à POST
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Public  Education  Service
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
“
160
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가지
▪ 외부에서
161
마이크로 서비스 간
(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
162
Front-­‐end
API	
  GW	
  (ZUUL)
ScheduleCalendar Clazz
Course
EUREKA
/
Kube-­‐DNS
Course:  ip1,  ip2
Clazz:  ip3
ScheduleCalendar:  ip4,  ip5
Ribbon	
  /
Envoy	
  
sidecar
Zuul을 경유하지 않고 직접 내부 IP  
로 접근
Use Case
163
Consumer Code: Clazz
164
@Entity
public  class  Clazz {
@Autowired
SharedCalendarService sharedCalendarService;;
@PrePersist
public  void  beforeSave()  {
if(getInstructor()!=null){
if(getClazzDays()==null)
throw  new  RuntimeException(Instructor  can  be  mapped   after  adding   class  days  for  this  class.);;
for(ClazzDay clazzDay :  getClazzDays()){
ListClazzDay  schedules  =  sharedCalendarService.getSchedules(clazzDay.getDate(),  getInstructor());;
if(schedules!=null    schedules.size()    0){
throw  new  RuntimeException(Instructor    +  getInstructor().getFirstName()  +    already  have  another  class  for  that  time  slot.);;
}
}
}
}
}
Service Interface: mark as @FeignClient
- EUREKA 버전
165
-­-­-­-­ Service  Id
이걸로, Autowired 시에
식별됨
@FeignClient(calendar)
public  interface  SharedCalendarService {
@RequestMapping(method   =  RequestMethod.GET,  path=/calendar/{instructorId}/{date})
Resources  getSchedules(@PathVariable(instructorId)  Long  instructorId,  @PathVariable(date)  String  date);;
}
Service Interface: mark as @FeignClient
- Kube-DNS 버전
166
-­-­-­-­ url이 부여되면
우선으로 url을 직접호출함
@FeignClient(name  =  calendar-­service”,  url=“http://calendar-­service:8080”)
public  interface  SharedCalendarService {
@RequestMapping(method   =  RequestMethod.GET,  path=/calendar/{instructorId}/{date})
Resources  getSchedules(@PathVariable(instructorId)  Long  instructorId,  @PathVariable(date)  String  date);;
}
Issues in Request-Response model
서비스구성 (Request-­Response,  Sync  호출)
Mileage
(MongoDB)
Clazz
(MySQL)
Client  (Web/Mobile)
POST
POST Yet  Another  SVC
(NoSQL)
POST
• 성능저하
• 장애전파
• 트랜잭션 처리를 위한 2PC  구현
장애전파 차단: 서킷브레이커 패턴
168
Client
Circuit
breaker Supplier
Connection
problem
timeouttimeout
timeouttimeout
trip
Circuit  open
장애 감지 시, 차단기 작동(Open)
일시 동안 Fallback으로 서비스 대체
일부 트래픽으로 서비스 정상여부 확인
정상 확인 시, 차단기 해제(Close)
“
169
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
170
Vs.
Inter-microservice Call - Event Publish / Subscribe (PubSub)
171
Course Clazz
Calendar
pub
(과정기획일정, 2018-­3-­5)
pub
(강의일정, 2018-­3-­6)
Event  Queue  (i.e.  Apache  Kafka)
sub
2018-­3-­6 OOO   OOO
2018-­3-­5  XXX  XXXXX
….
Event Consumer: calendar
172
@Component
public  class  EventListener {
/**  version  1.  callback  version  **/
@StreamListener(Streams.INPUT)
public  void  handleClazzDay(@Payload  ClazzDayRegistered clazzDayRegistered)  {
System.out.println(Received:  +  clazzDayRegistered.getDate());;  //  일정 db 에 저장.
}
}
Event Publisher
173
@Entity
public  class  ClazzDay{
…  
@PrePersist
public  void  publishEvent()  throws  JsonProcessingException {
Streams  streams  =  Application.getApplicationContext().getBean(Streams.class);;
MessageChannel messageChannel =  streams.outboundChannel();;
messageChannel.send(MessageBuilder
.withPayload(new  ClazzDayRegistered(this))          //  POJO  를 그대로 보낸다.
.setHeader(MessageHeaders.CONTENT_TYPE,  MimeTypeUtils.APPLICATION_JSON)
.build());;
System.out.println(Event  published);;
}
}
Distributed Transaction Issues
174
Eventual  Transaction  /  compensationAtomic  Transaction  /  2PC
Eventual TX를 통한 분산 트랜잭션 처리
총수강신청시간 : 500 총마일리지: 5
총수강신청시간 : 600 총마일리지: 5
총수강신청시간 : 600 총마일리지: 6
총수강신청시간 : 700 총마일리지: 6
총수강신청시간 : 700 총마일리지: 7
Consistent
In-­consistent
조회화면서비스구성 (Eventual  TX)
Mileage
(MongoDB)
Clazz
(MySQL)
Kafka
Enrolled
(pub)
Enrolled
(sub)
Client  (Web/Mobile)
POST
여기서 선택의 길을 만남
• 내 서비스에서 데이터 불일치가얼마나 미션크리티컬한가?
• 크리티컬 하다고 응답한다면, 내 서비스의 성능과확장성에비하여
크리티컬 한가?
• 성능과 확장성 보다 크리티컬 하다면, 성능과 확장성을 포기할 수 있는가?
• 성공한 내 서비스의 경쟁자들은무엇을 포기했는가?
• è 강력한 의사결정 필요 (무엇으로 태어날것인가…)
Eventual TX – 불일치가 Mission Critical 한 경우
총수강신청시간 : 500 총마일리지: 5
총수강신청시간 : 600 총마일리지: 5 (PENDING)
총수강신청시간 : 600 총마일리지: 6
총수강신청시간 : 700 총마일리지: 6  (PENDING)
총수강신청시간 : 700 총마일리지: 7
Consistent
In-­consistent
조회화면서비스구성 (Eventual  TX)
Mileage
(MongoDB)
Clazz
(MySQL)
Kafka
Enrolled
(pub,  PENDING)
Enrolled
(sub)
Client  (Web/Mobile)
POST
All-­done
(pub)
All-­done
(sub,  CLEAR  PENDING)
Eventual TX
– Rollback (Saga Pattern)
총수강신청시간 : 500 총마일리지: 5
총수강신청시간 : 600 총마일리지: 5 (PENDING)
총수강신청시간 : 600 총마일리지: 6
총수강신청시간 : 700 총마일리지: 6  (PENDING)
총수강신청시간 : 700 총마일리지: 7  à 취소됨
Consistent
In-­consistent
조회화면서비스구성 (Eventual  TX)
Mileage
(MongoDB)
Clazz
(MySQL)
Kafka
Enrolled
(pub,  PENDING)
Enrolled
(sub)
Client  (Web/Mobile)
POST
All-­done
(pub)
CANCELLED
(sub,  DELETE  or  CANCEL)
CANCELLED
(pub)
If~else
총수강신청시간 : 600 총마일리지: 6
Resources on Sagas
▪ http://eventuate.io/
▪ https://vladmihalcea.com/how-to-extract-change-
data-events-from-mysql-to-kafka-using-
debezium/?fbclid=IwAR33Spb4jPBNI6VNHuCxdu_
BxpWdzOLzMvbCtHHvJrRmJPfiEoXwM1qWYBs
179
“
180
Data Query (Projection) in MSA
▪ Issues: Existing Join Queries and Performance Issues
▪ Composite Services or GraphQL
▪ Event Sourcing and CQRS
분산서비스에서의 Data Projection Issue
181
Order
id  :  3492-­2323
restaurant   :  Ajanta
Ticket
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  ServiceKitchen   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
182
Order
id  :  3492-­2323
restaurant   :  Ajanta
_links:{
ticket:    
http://tickets/3492-­
2323
delivery:  
http://deliveries/45-­
4545
bill:  http://bills/343-­
45611
}
Ticket
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  ServiceKitchen   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
183 Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
≪aggregate≫
Charge
Accounting   Service
≪aggregate≫
Delivery
Delivery  Service
≪aggregate≫
RestaurantOrder
Kitchen   Service
≪aggregate≫
Order
Order  Service
Find  Order
Composer
GET/orders/
{orderId}
GET/tickets?  
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
184
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
185
Order  Service
Kitchen  
Service
Delivery  
Service
Accounting  
Service
Order  Service
Order  history
view   database
Order
Events
Ticket
Events
Delivery
Events
Accounting
Events
findOrderHistory(  )
findOrder(  )
Event
handlers
(Materialized  View)
Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
CQRS 의 확장 : Multiple Event Sources and
Multiple Read Models
186
장점: 현존 가장 최적의 Microservice 를
위한 분산 데이터베이스 모델임
1. 서비스별 최적화된 데이터모델
2. 다양한 데이터베이스/저장소 기술 선택
데이터베이스 (Polyglot  Persistency)
3. Maximum  Loosely-­coupled Design
4. 새로운 서비스 확장에 완전한 Open
è 이를 위하여
발생하는 모든 주요 비즈니스이벤트를
Publish  하는 이벤트 소싱의 처리와
이벤트 포맷의 표준화가 필요
Lab: CQRS with Kafka
187
▪수강생 대시보드 구현 요구사항:
▫Real-time and Reactive User Interfaces
▫노티
▫강사와 메시징 기반 질의응답
▪Long-Running Processes:
▫수강신청
▫승인/반려
▫결제
▪Multi-dimensional Views
▫수강진행률
▫과정별/강사별/항목별 강의 조회
▪Massive / web-scaled data
▫강의수강 패턴 분석
▫다음 강의 추천
CRQS with Kafka
188
1
Enrolled  
100  hour  
for  
customer1
2
Approved  
the  
enrollment  
1
3
Enrolled 50  
hour  for  
customer2
4
Cancelled  
Enrollment  
2
5
Class  
Attended  
for  
Enrollment  
2
6
Payment  
Done  for  
Enrollment  
2
7
Enrolled  50  
hour  for  
customer4
8
…
9
…
수강신청 캘린더
Kafka
Event  ConsumersFront-­end  (MVVM)
Cache  
(Redis)
대시보드 마케팅
Early  
Warning
(KSQL)
대시보드UI Push  
Service
(SSE  
Emitter)
결제
pub sub
sub pub
sub sub subsub
CQRS with Kafka
189
1
Enrolled  
100  hour  
for  
customer1
2
Approved  
the  
enrollment  
1
3
Enrolled 50  
hour  for  
customer2
4
Cancelled  
Enrollment  
2
5
Class  
Attended  
for  
Enrollment  
2
6
Payment  
Done  for  
Enrollment  
2
7
Enrolled  50  
hour  for  
customer4
8
…
9
…
수강신청 캘린더
Kafka
Event  ConsumersFront-­end  (MVVM)
Cache  
(Redis)
대시보드 마케팅
Early  
Warning
(KSQL)
대시보드 UI Push  
Service
(SSE  
Emitter)
결제
pub sub
sub pub
sub sub subsub
수강이
신청됨
수강이
승인됨
수강완료함
지불완료됨
축하메시
지발송
총
수강시간
변경
취소
안내메일
발송
Event Sourcing
1 2 3 4 5 6 7 8 9
Append  the  “Changes”  only
Kafka
1:      key:  account1,  value:  {  action:  수강신청,  course:  123,  time:  100  }
2:      key:  account1,  value:  {  action:  승인,  course:  456,  time:  50  }
3:      key:  account2,  value:  {  action:  수강완료,  course:  123,  time:  50  }
4:      key:  account2,  value:  {  action:  결재완료,  course:  678,  time:  50  }
5:      key:  account1,  value:  {  action:  수강신청,  course:  789,  time:  50  }
6:      key:  account3,  value:  {  action:  반려,  course:  123,  time:  100  }
….
Kafka
custo
mer
Total
enrolle
d  time
1 100
custo
mer
Total
enrolle
d  time
1 150
custo
mer
Total
enrolle
d  time
1 150
2 50
custo
mer
Total
enrolle
d  time
1 150
2 0
custo
mer
Total
enrolle
d  time
1 100
2 0
custo
mer
Total
enrolle
d  time
1 100
2 0
3 50
custo
mer
Total
enrolle
d  time
1 100
2 0
3 50
4 50
Read Model for Dashboard
1
Enrolled  
100  hour  
for  
customer1
2
Enrolled 50  
hour  for  
customer1
3
Enrolled 50  
hour  for  
customer2
4
Cancelled  
50  hour  for  
customer2
5
Cancelled
50  hour  for  
customer1
6
Cancelled  
50  hour  for  
customer3
7
Enrolled  50  
hour  for  
customer4
8
…
9
…
총 수강시간 Table
1  minlater 2  min  later 3  min  later 4  min  later 5  min  later 6  min  later 7  min  later
Snack  bar  
pops  up
Your  Total  
Enrollment  Is
100  hr
You’ve  
enrolled  50  
hour
Undo
Your  Total  
Enrollment  Is
150  hrYou’ve  
enrolled  50  
hour
Undo
Your  Total  
Enrollment  Is
100  hr
You’ve  
cancelled  50
Undo
Your  Total  
Enrollment  Is
200  hr
You’ve  
enrolled  50
Undo
Your  Total  
Enrollment  Is
50  hr
You’ve  
cancelled  50
Undo
Read Model for Front-end (Push service)
1
Enrolled  
100  hour  
for  
customer1
2
Enrolled 50  
hour  for  
customer1
3
Enrolled 50  
hour  for  
customer2
4
Cancelled  
50  hour  for  
customer2
5
Cancelled
50  hour  for  
customer1
6
Cancelled  
50  hour  for  
customer3
7
Enrolled  50  
hour  for  
customer4
8
…
9
…Kafka
1  second  later 2  second  later 3  second  later 4  second  later 5  second  later 6  second  later 7  second  later
서두르세요!
수강신청률이
저조합니다.  
**  Using  KSQL  or  Kstreams:
Read Model for Real-time Analytic
1
Enrolled  
100  hour  
for  
customer1
2
Enrolled 50  
hour  for  
customer1
3
Enrolled 50  
hour  for  
customer2
4
Cancelled  
50  hour  for  
customer2
5
Cancelled
50  hour  for  
customer1
6
Cancelled  
50  hour  for  
customer3
7
Enrolled  50  
hour  for  
customer4
8
…
9
…Kafka
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,  IAM194
“
Table of Content
Microservice and  SOA  
Programming+Microservice-­Based
DevOps  Project
1. Review  for  the  Domain  Problem:    A  Public  Education  Service
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
“
196
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: 열차말고 택시를 타라!
197
모노리식 개발 및 운영환경
• 모노리식 환경하에서는 큰 개발팀이 하나의 소스코드레파지토리에 변경 사항을
커밋하므로 코드간 상호 의존도가 높아 신규 개발 및 변경이 어려움
• 작은 변경에도 전제를 다시 테스트/ 배포하는 구조이므로통합 스케줄에 맞춘 파이프
라인을 적용하기가 어렵고 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
198 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
199
CI/CD Tools – conventional CI/CD
200
❑ 잦은 배포
❑ 일반 서버에 배포
❑ 테스트 자동화/커버리지
❑ 도구: Jenkins,  Travis,  Gitlab 등
CI/CD Tools – Container-based
201
❑ Immutable  Image
❑ API  Testing
❑ Blue/Green,  Canary
❑ 도구: Jenkins  +  Docker  +  Spinnaker  +  Helm  +  Kubernetes
à 매우복잡
CI/CD Tools - Serverless
202
❑ Infrastructure  As  A  Code
❑ Application  Configuration  과 Infra
Configuration을 하나의 설정에
통합
❑ 단일 도구
Smart Deploy Strategies
▪ https://thenewstack.io/deployment-strategies/
▪ Recreate: Version A is terminated then version B is rolled out.
▪ Ramped (also known as rolling-update or incremental): Version B is slowly rolled
out and replacing version A.
▪ Blue/Green: Version B is released alongside version A, then the traffic is switched
to version B.
▪ Canary: Version B is released to a subset of users, then proceed to a full rollout.
▪ A/B testing: Version B is released to a subset of users under specific condition.
▪ Shadow: Version B receives real-world traffic alongside version A and doesn’t
impact the response.
203
비교
204
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
Production Debugging Tools (APM)
▪ Zipkin
▪ Pinpoint
▪ Elasticsearch ELK
206
Lab: Running Micro Services in Docker
207
Executable  Jar
Docker  Image
(template)
Docker  Registry
(referenceable  
by  image  name)
Source  Code
mvn package  -­B Docker  pushdocker build
Running apps anywhere and reliably
▪ 개발, 스테이징, 운영에서 최대한 동일하게 동작하기
위해서는
▫ 죽였다 살려내면 복구되는 (Immutable Image)
▫ 어디서나 실행되는
▫ 그러면서 가벼운 환경
Dockerfile: 도커 이미지 스크립트
#  기반 이미지
FROM  openjdk:8u111-­jdk-­alpine
# 볼륨 연결
VOLUME  /tmp
# 애플리케이션 복사
ADD  /target/*.jar   app.jar
# 포트노출
EXPOSE  8080
# 자바 실행
ENTRYPOINT  [java,-­Xmx256M,-­jar,/app.jar]
209
Lab time: Create and push Docker images
$  cd  course-­service
$  docker build  -­t  gcr.io/projectId/course:v1    .
$  docker push  gcr.io/projectId/course:v1  
…
$  cd  ../clazz-­service
$  docker build  -­t  gcr.io/projectId/clazz:v1    .
$  docker push  gcr.io/projectId/clazz:v1  
…
$  cd  ../shared-­calendar-­service
$  docker build  -­t  gcr.io/projectId/shared-­cal:v1    .
$  docker push  gcr.io/projectId/shared-­cal:v1  
210
Lab time: Run the app with Docker
docker run -p 8080:80 gcr.io/projectId/course
211
Lab time: Basic Commands
https://docs.docker.com/get-­started/part2/#recap-­and-­cheat-­sheet-­optional
212
“
213
Container Orchestration with
Kubernetes
▪ Kubernetes Object Model
▪ Users to Pods: Services, Kube-proxy, Service
Discovery, ServiceType
▪ Deploying Stand-Alone Application
▪ Liveness and Readiness
▪ Kubernetes Volume Management
▪ Multi-Tier Application
https://www.youtube.com/watch?v=gauOI0O9fRMfbcli
d=IwAR2y8nBOfi0ehHysOx-­
MtxSzDXzpv77sWnBg_pUEyIprE2fpMYuxBl3spq8
Kubernetes
214
Master Workers
Kubernetes: 발음하기
215
미국식: 큐브네리스
영국식: 쿠버네티스
인도식: 꾸-­버네띡스
Container-based Application Design
216 https://kubernetes.io/blog/2018/03/principles-­of-­container-­app-­design/?fbclid=IwAR2oMrdP0d1Q6LXebtxNPnt-­RS5DIlkCIwpaMSL5mmW7VMaQb6hRV8hkd38
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
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
Kubernetes Object Model
▪ apiVersion : mentions the API endpoint on the API
server which we want to connect to.
▪ kind : mentions the object type – example
has Deployment.
▪ metadata : has the basic information to objects, like the
name.
▪ spec (spec and spec.template.spec) : defines the desired state of
the deployment. In our example, we want to make sure
that, at any point in time, at least 3 Pods are running,
which are created using the Pods Template defined
in spec.template.
▪ spec.template.spec : defines the desired state of the
Pod. The example Pod would be created
using nginx:1.7.9.
Once the object is created, the Kubernetes system attaches
the status field to the object
apiVersion:  apps/v1
kind:  Deployment
metadata:
name:  nginx-­deployment
labels:
app:  nginx
spec:
replicas:  3
selector:
matchLabels:
app:  nginx
template:
metadata:
labels:
app:  nginx
spec:
containers:
-­ name:  nginx
image:  nginx:1.7.9
ports:
-­ containerPort:  80
Deployment  object  Example
Google Kubernetes Engine
220
SSH  접속
설정 파일 및 소스코드 편집
SSH  – 모든 명령 기본 설치
가입
221
https://cloud.google.com 에 접속
1년 무상 트라이얼 제공
동의
몇가지 동의에 체크한 후, 계속하기클릭
카드입력
카드 번호 입력 (유저 밸리데이션 목적)
대시보드
메인 화면 도달
프로젝트 생성
프로젝트 생성
프로젝트 생성
자동생성된 프로젝트ID  를 사용 X
(“수정” 클릭)
프로젝트 ID  입력
(글로벌리 유일한 ID)
쿠버네티스 클러스터 생성
상단의 이 버튼 클릭 
웹브라우저용 SSH  콘솔이 생김
쿠버네티스 클러스터 생성
상단메뉴 
Kubernetes  Engine    
클러스터 선택
쿠버네티스 클러스터 생성
클러스터 명을 적절히 주고,
Zone  = us-­central1-­a
Region  = us-­central1
Node  =  3
로 설정
혹은, 콘솔에서
▪gcloud config set compute/zone us-central1-a
▪gcloud config set compute/region us-central1 gcloud container clusters create my-first-cluster
스크립트 주소:
https://github.com/TheOpenCloudEngine/uEngine-­cloud/wiki/Kubernetes-­
%EC%8B%A4%EC%8A%B5-­%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8
웹 편집기 사용
Lab Time: 기본적인 kubectl명령어
▪객체 목록 불러오기
▫ “kubectl get [객체 타입]“
Ex) kubectl get pods : pod 목록 불러온다.
▪객체 삭제하기
▫ “kubectl delete [객체 타입] [객체 이름]”
Ex) “kubectl delete pods wordpress-5bb5dddcff-kwgf8”
▫ “kubectl delete [객체타입,객체타입,…] --all“
Ex) “kubectl delete services,depeloyments,pods –-all”
- 실습 중에 잘못 생성되었거나 초기화가 필요할 경우 사용
▪객체 상세 설명 확인하기
▫ “kubectl describe [객체 타입] [객체 이름] ”
Ex) “kubectl describe service wordpress”
이미지를 통한 어플리케이션 배포
• 현재 작동 중인 pod들이 없는지 확인
▫ kubectl get pods
▪ Nginx이미지 예제로 배포하기
▫ kubectl run first-deployment --image=nginx
▪ 실행된 Pods 확인
▫ kubectl get pods
(검색된 Pod의 이름을 복사한다. (각 pod들은 고유한 이름을 갖는다.)
designing, implementing and delivering microservices with event storming, spring cloud, and kubernetes
designing, implementing and delivering microservices with event storming, spring cloud, and kubernetes
designing, implementing and delivering microservices with event storming, spring cloud, and kubernetes
designing, implementing and delivering microservices with event storming, spring cloud, and kubernetes

Mais conteúdo relacionado

Mais procurados

Open Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS SnapshotsOpen Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS SnapshotsuEngine Solutions
 
Process Oriented Architecture
Process Oriented ArchitectureProcess Oriented Architecture
Process Oriented ArchitectureuEngine Solutions
 
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅Open Source Consulting
 
[웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10!
[웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10![웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10!
[웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10!Open Source Consulting
 
Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud Sangwon Seo
 
[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
 
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
 
Cloud for Kubernetes : Session2
Cloud for Kubernetes : Session2Cloud for Kubernetes : Session2
Cloud for Kubernetes : Session2WhaTap Labs
 
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브Open Source Consulting
 
Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...
Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...
Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...Cloud-Barista Community
 
[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅
[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅
[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅Open Source Consulting
 
AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화
AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화
AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화Amazon Web Services Korea
 
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...Atlassian 대한민국
 
클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1Chimin Park
 
[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론
[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론
[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론Alex Hahn
 
Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...
Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...
Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...Cloud-Barista Community
 
[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기
[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기
[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기Amazon Web Services Korea
 

Mais procurados (20)

Open Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS SnapshotsOpen Cloud Engine PaaS Snapshots
Open Cloud Engine PaaS Snapshots
 
Microservice coding guide
Microservice coding guideMicroservice coding guide
Microservice coding guide
 
Process Oriented Architecture
Process Oriented ArchitectureProcess Oriented Architecture
Process Oriented Architecture
 
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
4시간 안에 끝내는 AWS 클라우드 전환 및 운영 환경 구성_최지웅_오픈소스컨설팅
 
[웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10!
[웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10![웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10!
[웨비나] 클라우드 마이그레이션 수행 시 가장 많이 하는 질문 Top 10!
 
Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud
 
[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
 
Open infra and cloud native
Open infra and cloud nativeOpen infra and cloud native
Open infra and cloud native
 
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
 
Cloud for Kubernetes : Session2
Cloud for Kubernetes : Session2Cloud for Kubernetes : Session2
Cloud for Kubernetes : Session2
 
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
 
Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...
Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...
Cloud-Barista 제4차 오픈 컨퍼런스 : CB-Ladybug - 멀티클라우드 애플리케이션 서비스 통합 운용 및 관리 (Integr...
 
[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅
[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅
[오픈소스컨설팅]Data Center to cloud - 최지웅 컨설팅코치, 오픈소스컨설팅
 
[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트
[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트
[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트
 
AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화
AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화
AWS 12월 웨비나 │성공적인 마이그레이션을 위한 클라우드 아키텍처 및 운영 고도화
 
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
Atlassian 트러블슈팅 및 가상화기반 Confluence Data Center 구축 - 오픈소스...
 
클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1클린아키텍처와 DDD - day1
클린아키텍처와 DDD - day1
 
[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론
[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론
[SW 아키텍처 컨퍼런스] 클라우드 아키텍처 개론
 
Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...
Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...
Cloud-Barista 제4차 오픈 컨퍼런스 : Cloud-Barista - 멀티클라우드 서비스 공통 플랫폼 개요 (Multi-cloud...
 
[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기
[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기
[2017 AWS Startup Day] 인프라 관점에서 접근하는 리디스토리 개발기
 

Semelhante a designing, implementing and delivering microservices with event storming, spring cloud, and kubernetes

꿀밋업1탄_왜_마이크로서비스인가
꿀밋업1탄_왜_마이크로서비스인가꿀밋업1탄_왜_마이크로서비스인가
꿀밋업1탄_왜_마이크로서비스인가VMware Tanzu Korea
 
[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...
[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...
[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...OpenStack Korea Community
 
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기Amazon Web Services Korea
 
[오픈소스컨설팅] 2019년 클라우드 생존전략
[오픈소스컨설팅] 2019년 클라우드 생존전략[오픈소스컨설팅] 2019년 클라우드 생존전략
[오픈소스컨설팅] 2019년 클라우드 생존전략Ji-Woong Choi
 
성공적인 하이브리드 클라우드를 위한 레드햇의 전략
성공적인 하이브리드 클라우드를 위한 레드햇의 전략성공적인 하이브리드 클라우드를 위한 레드햇의 전략
성공적인 하이브리드 클라우드를 위한 레드햇의 전략rockplace
 
Openshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud NativeOpenshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud Nativerockplace
 
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
 
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해Terry Cho
 
클라우드 네이티브 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
 
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM Bluemix
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM Bluemix제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM Bluemix
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM BluemixTommy Lee
 
Cloud native application 입문
Cloud native application 입문Cloud native application 입문
Cloud native application 입문Seong-Bok Lee
 
Deployment techniques for cloud native
Deployment techniques for cloud nativeDeployment techniques for cloud native
Deployment techniques for cloud nativeAlex Jeong
 
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?VMware Tanzu Korea
 
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원BESPIN GLOBAL
 
오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3
오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3
오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3Heejong Lee
 
클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017
클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017
클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017Amazon Web Services Korea
 
Open standard open cloud engine for digital business process
Open standard open cloud engine for digital business process Open standard open cloud engine for digital business process
Open standard open cloud engine for digital business process uEngine Solutions
 
Intro to hpe helion stackato_paa_s
Intro to hpe helion stackato_paa_sIntro to hpe helion stackato_paa_s
Intro to hpe helion stackato_paa_sSeong-Bok Lee
 
락플레이스 OpenShift Q&A 토크쇼 발표자료
락플레이스 OpenShift Q&A 토크쇼 발표자료락플레이스 OpenShift Q&A 토크쇼 발표자료
락플레이스 OpenShift Q&A 토크쇼 발표자료rockplace
 
Meetup tools for-cloud_native_apps_meetup20180510-vs
Meetup tools for-cloud_native_apps_meetup20180510-vsMeetup tools for-cloud_native_apps_meetup20180510-vs
Meetup tools for-cloud_native_apps_meetup20180510-vsminseok kim
 

Semelhante a designing, implementing and delivering microservices with event storming, spring cloud, and kubernetes (20)

꿀밋업1탄_왜_마이크로서비스인가
꿀밋업1탄_왜_마이크로서비스인가꿀밋업1탄_왜_마이크로서비스인가
꿀밋업1탄_왜_마이크로서비스인가
 
[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...
[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...
[OpenInfra Days Korea 2018] (Track 2) Microservice Architecture, DevOps 그리고 5...
 
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
 
[오픈소스컨설팅] 2019년 클라우드 생존전략
[오픈소스컨설팅] 2019년 클라우드 생존전략[오픈소스컨설팅] 2019년 클라우드 생존전략
[오픈소스컨설팅] 2019년 클라우드 생존전략
 
성공적인 하이브리드 클라우드를 위한 레드햇의 전략
성공적인 하이브리드 클라우드를 위한 레드햇의 전략성공적인 하이브리드 클라우드를 위한 레드햇의 전략
성공적인 하이브리드 클라우드를 위한 레드햇의 전략
 
Openshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud NativeOpenshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud Native
 
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 마이그레...
 
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
 
클라우드 네이티브 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
 
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM Bluemix
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM Bluemix제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM Bluemix
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나- IBM Bluemix
 
Cloud native application 입문
Cloud native application 입문Cloud native application 입문
Cloud native application 입문
 
Deployment techniques for cloud native
Deployment techniques for cloud nativeDeployment techniques for cloud native
Deployment techniques for cloud native
 
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
MSA 전략 2: 마이크로서비스, 어떻게 구현할 것인가?
 
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
 
오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3
오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3
오라클 클라우드와 함께 떠나는 마이크로서비스 아키텍처로의 여행 V3
 
클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017
클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017
클라우드 세상에서 IT 관리자로 살아남기 - AWS Summit Seoul 2017
 
Open standard open cloud engine for digital business process
Open standard open cloud engine for digital business process Open standard open cloud engine for digital business process
Open standard open cloud engine for digital business process
 
Intro to hpe helion stackato_paa_s
Intro to hpe helion stackato_paa_sIntro to hpe helion stackato_paa_s
Intro to hpe helion stackato_paa_s
 
락플레이스 OpenShift Q&A 토크쇼 발표자료
락플레이스 OpenShift Q&A 토크쇼 발표자료락플레이스 OpenShift Q&A 토크쇼 발표자료
락플레이스 OpenShift Q&A 토크쇼 발표자료
 
Meetup tools for-cloud_native_apps_meetup20180510-vs
Meetup tools for-cloud_native_apps_meetup20180510-vsMeetup tools for-cloud_native_apps_meetup20180510-vs
Meetup tools for-cloud_native_apps_meetup20180510-vs
 

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
 
Distributed transanction in microservices
Distributed transanction in microservicesDistributed transanction in microservices
Distributed transanction in microservicesuEngine 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
 
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 almuEngine 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 (18)

이벤트스토밍과 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
 
Distributed transanction in microservices
Distributed transanction in microservicesDistributed transanction in microservices
Distributed transanction in microservices
 
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
 
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
 
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_클라우다인_김병곤 대표이사
 

designing, implementing and delivering microservices with event storming, spring cloud, and kubernetes

  • 1. Micro Service Architecture Copyright © 2018. Jinyoung Jang & uEngine-solutions All rights reserved.
  • 2. 강의를 시작하기 전에 - Backchannel 스크립트 복사 자료 공유 의견/질의 강의중 명령모음
  • 3. URL for sample project 3 https://github.com/uengine-­oss/msa-­tutorial-­class-­management-­monolith https://github.com/uengine-­oss/msa-­tutorial-­class-­management-­msa https://github.com/uengine-­oss/msa-­tutorial-­class-­management-­frontend
  • 4. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 5. 퍼블릭 에듀케이션 영역 예제 ▪모 교육기관의 실질적 강좌강의수강 시스템의 실질 요구사항과 교재 개발에 참여함 ▪해당 요구사항은 강좌기획, 강의(클래스)관리, 수강관리 등 서브도메인으로 나뉘어 마이크로서비스 분석 예제로 적합함 ▪강의 신청 기간에 특정 서비스가 핫- 스폿으로 요청이 폭주하는 경향은 마이크로 서비스의 Self-Healing, 결함내성, 동적 확장 등의 MSA 설계 강점을 잘 설명할 수 있음 ▪챗봇을 통한 강의 수강 신청등의 자동화를 통하여 Dynamically Reconfigurable 한 MSA 수준의 기능을 시연할 수 있음
  • 9. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 10. AS-IS: Pain-points • 운영팀과 개발팀이 분리되어 개발팀의 반영을 운영팀이 거부하는 사례 발생 • 개발팀은 새로운 요건을 개발했으나, 이로인해 발생하는 오류가 두려워 배포를 꺼려함 • 현재 미국, 일본, 유럽 등 수요가 늘어나는 상황이나, 상기한 문제로 신규 고객의 요구사항을 받아들이지 못하는 상황 • 수동 운영의 문제로, SLA 준수가 되지 못하여 고객 클레임이 높은편 • 기존 모놀로씩 아키텍처의 한계로 장기적인 발전의 한계에 봉착 • 서비스 업그래이드가 수시로 요청이 들어와 거의 매일 야근중. 개발자 행복지수가 매우 낮음. • 한팀의 반영이 전체팀의 반영에 영향을 주어 거의 매일 야근해야 함. 행복지수 낮음을 토로함. • 테넌트별 다형성 지원을 제대로 하지 못하여 가입고객이 늘 때마다 전체 관리 비용이 급수로 올라가는 한계에 봉착함 • 자체 IDC를구성하여 하드웨어, 미들웨어 구성을 직접해야 하는 비용문제.
  • 11. Speed to digital transformation SPEED 비즈니스 애플리케이션 개발에 과도하게 소요되는 시간은 분석과 반복적인 중복코드, 운영 단절에 의한 오류 감소로 인한 생산성 극대화와 Time-to- Market 최소화 Software development is a learning process, working code is a side effect - Martin Fowler
  • 12. DevOps: Issues Continuous Delivery 12 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,
  • 18. 항상성 (Self-Healing) 이 자동으로 유지되면 어떨까? 14
  • 19. 자원을 최대한 공유할 수 있을까? 15
  • 20. Continuous Delivery Zero Downtime Deployment 가 되면 어떨까? 16
  • 21. 17 2. 배포 주기 • 매일 마이너 업데이트 • 메이저 업데이트 (매주 화요일 오후) 3. Deployment
  • 22.  Pipeline 출처:  http://ieeexplore.ieee.or g/xpl/artic leDet ails.jsp?arnumber=6449236 Supporting Continuous Delivery Facebook
  • 23. 18 4. Canary를통해서확신 갖기 • Canary란? 실제production
  • 25.  subset에서새로운코드를 돌려보고 옛날 코드와 비교해서 새로운 코드가어떻게 돌아가는 지 보는 것 • Canary
  • 32.  avg등이옛날 코 드랑 새로운 코드랑 비교해서 어떻게다른 지 확인하는것)은 1000개 이상의metric을 비교해서 100점 만점에 점수를 주고 일정 점수일 경우만배포할 수 있음. 출처: http://techblog.netflix.com/2013/08/deploying-­ netflix-­ api. html Supporting Continuous Delivery Netflix
  • 33. 출처 :  2010  architecting  for  the  cloud  (http://www.slideshare.net/simone.brunozzi/2010-­architecting-­for-­the-­cloud-­4719195) DevOps: Issues Managing Scalability
  • 34. Managing Scalability Workload Distribution Engine desired=5 desired=5 desired=4 ERP:  1              2          3                            4                                        5 CRM:                                1            2            3                        4            5 BI                                                                            1            2          3            4
  • 35. Managing Scalability Workload Distribution Engine desired=5 desired=5 actual=4 desired=4 actual=3actual=4
  • 36. Managing Scalability Workload Distribution Engine desired=5 desired=5 actual=5 desired=4 actual=5actual=5
  • 38. Managing Scalability Workload Distribution Engine ERP  v2 SW  router  (HA  proxy,  Envoy,  nginx)
  • 39. ▪IBM Bluemix ▪Heroku ▪GE’s Predix ▪Pivotal Web Services • Cloud  Foundry Container Workload  Distribution   Engine  (OSS) PaaS • Warden(Garden) • Docker • Kubernetes • Docker  SWARM • Mesos DC/OS • Google  Compute  Engine  (GKE) • AWS  EKS • Azure,  Alibaba • Redhat Open  Shift • Hypervisor • CF  version  1 • Engineyard….   • Amazon  Beanstalk DevOps DevOps  Platforms
  • 40. Top 9 Rules for Cloud Applications (IBM) 26 1 1. Don't  code  your  application  directly  to  a  specific  topology 2. Don't  assume  the  local  file  system  is  permanent 3. Don't  keep  session  state  in  your  application 4. Don't  log  to  the  file  system 5. Don't  assume  any  specific  infrastructure  dependency 6. Don't  use  infrastructure  APIs  from  within  your  application 7. Don't  use  obscure  protocols 8. Don't  rely  on  OS-­specific  features 9. Don't  manually  install  your  application
  • 42. DevOps Platform IBM Bluemix – Auto Scaling
  • 43. DevOps  Platform IBM  Bluemix – Zero  Downtime   Deploy
  • 44. 사례: Amazon.com ▪수 천개의 팀 그리고 Autonomy ▪마이크로 서비스 ▪지속적 배포 ▪다양한 플랫폼 (폴리글롯) ▪== 연간 5천만회 배포 ▪시간당 5078회 또는 0.63초당 1회 ▪자동화된 DevOps 환경 없이는 운영불가
  • 45. Monolithic Architecture à 모든 서비스가 한번에 재배포 à 한팀의 반영을 위하여 모든 팀이 대기 à 지속적 딜리버리가 어려워
  • 46. Micro Service Architecture Contract based, Polyglot Programming à Separation of Concerns, Parallel Development, Easy Outsourcing Written  in  Java Written  in  Node Written  in  PHP
  • 47. 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. 33
  • 49. 효과 – 장애 최소화 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 데이 터베 이스 재무 데이 터베 이스 생산 데이 터베 이스 인사 장애가 전파되며, 수동 복구로 장애지연 장애가 격리되며, 자동으로복구됨(이전버전)
  • 50. Java/J2EE 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 RDB 재무 (Java/ Tomc at) RDB 생산 (Java/ Spring) RDB 인사 (.NET) 효과 – 기능 확장 수익 성 분석 스키 마 체인 지 No SQL 수익 성 분석 (pytho n) 기존 코드의 수정 à Big  Impact 신규 마이크로서비스의 추가 à Minimal  Impact 자율적 기술선택(플랫폼  데이터레이아웃)
  • 51. Java/J2EE 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 RDB 재무 (Java/ Tomc at) 생산 (Java/ Spring) RDB 인사 (.NET) 효과 – 기능 확장 수익 성 분석 스키 마 체인 지 No SQL 수익 성 분석 (pytho n) 기존 코드의 수정 à Big  Impact 신규 마이크로서비스의 추가 à Minimal  Impact 자율적 기술선택(플랫폼  데이터레이아웃)
  • 52. 프론트엔드 데이터베이스 재무 생산 인사 프론트엔드 재무 생산 인사 효과 – 성능 배분 생산 계획 생산 계획 스케일업을 통해서만확장 수익성 분석의 워크로드에대한 스케일 아웃용이 생산 계획
  • 53. Micro Service Architecture ▪변경된 서비스만 재배포 à Side effect 최소화 ▪자율성 à 각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이 ▪병렬 개발, 타임 투 마켓, 린 개발
  • 54.
  • 55. Netflix 넷플릭스는 수백개의마이크로서비스를운영하고있는 것으로유명하다. 각 마이크로서비스간에는 REST  방식의호출을 통하여 연동되며 이들간의 자동화된 식별과 동적 연동을 위하여 자체적인 플랫폼을 구축했고 이를Netflix  OSS  라는 이름으로오픈소스화 하였다.
  • 56. AWS 기반 마이크로 서비스 전환 사례 Gaming  Platform Mobile  Apps  and Serverless Microservices IoT Service Serverless Microservices From  Monolithic  to Microservices Pure  Play  Video  OTT-­ A Video    Broadcasting
  • 57. ▪가장 작고 독립적인 서비스로 부터 마이그래이션 ▪순차적 레거시의 마이크로서비스 전환을 위한 API GW 적용한 “스트랭글러 패턴” 적용 ▪서비스 폴백 테스트 및 자동화가 필수 조건
  • 58. ▪새로 추가/변경 필요한기능부터분리 ▫안정된 레거시는 가능한 손대지 않음 ▫적은 리스크 업무 영역부터 ▫기술보다 노하우와 팀의 문화 정립 우선시 ▪Business Domain 단위 서비스구성 ▫팀단위 분리 X, 기술적 단위 분리X ▫비즈니스 서브 도메인 단위로의구성 à Separation ofConcerns ▫응집도 ▪서비스 존재 목적은 재사용되어지는 것 ▫표준화된 API I/F ▫자동화된 문서화
  • 60. MSA Trade-offs (from Martin Fowler) 46
  • 61. 47
  • 62. Conclusion ▪MSA 는 성공적인 SaaS 의 디자인 패턴: ▪Back-end API 설계가 중요 ▫ REST MM Level 3 – HATEOAS ▫ Aggregation of data from multi micro-services ▪MSA 를 적용하려면 작은 단위의 배포를 위한 운영 자동화 환경이 제공되어야 함 ▫ Container Orchestrator ▫ DevOps Platform 48
  • 64. 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,  IAM50
  • 65. 10 Attributes of Cloud Native Applications 51 1. Packaged  as  lightweight  containers 2. Developed  with  best-­of-­breed  languages  and  frameworks 3. Designed  as  loosely  coupled  microservices 4. Centered  around  APIs  for  interaction  and  collaboration 5. Architected  with  a  clean  separation  of  stateless  and  stateful services 6. Isolated  from  server  and  operating  system  dependencies 7. Deployed  on  self-­service,  elastic,  cloud  infrastructure 8. Managed  through  agile  DevOps  processes 9. Automated  capabilities 10. Defined,  policy-­driven  resource  allocation https://thenewstack.io/10-­key-­attributes-­of-­cloud-­native-­applications/
  • 67. Deployment - MSA 53 • Dynamic  Discovery  /  Binding • Self  Healing  /  Auto  Fail-­over • Load  balancing  /  Cluster Course Class Cloud  Infra Container  /  Orchestrator External Dependency   Services
  • 70. Tools covering Microservices: 2000s 56 BPEL4WS
  • 71. Netflix OSS 와 Spring Cloud 의 등장 넷플릭스는 수백개의마이크로서비스를운영하고있는 것으로유명하다. 각 마이크로서비스간에는 REST  방식의호출을 통하여 연동되며 이들간의 자동화된 식별과 동적 연동을 위하여 자체적인 플랫폼을 구축했고 이를Netflix  OSS  라는 이름으로오픈소스화 하였다.
  • 73. Tools: Evolution of Module Systems 59 Java  Module  System Hypervisors Containers Approach #2: Container-based Deployment
  • 74. Approach #2: Container-based Deployment 60 https://kubernetes.io/blog/2018/03/principles-­of-­container-­app-­design/?fbclid=IwAR2oMrdP0d1Q6LXebtxNPnt-­RS5DIlkCIwpaMSL5mmW7VMaQb6hRV8hkd38
  • 75. Approach #3: Event Driven Architecture Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­ systems-­with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 76. Monolith: • With  Canonical  Model • (“Rule  Them  All”  model) Reactive  Microservices: • Autonomously  designed  Model(Document) • Polyglot  Persistence E E Approach #3: Event Driven Architecture Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­systems-­with-­event-­ storming-­73c6236f5dd7,  Kevin  webber
  • 77. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 78. Domain-Driven Design MSA ▫ Bounded Context à 어떤 단위가 마이크로 서비스가 될 수 있는가? ▫ Context Mapping à 서비스를 결합 할 때는 어떻게 결합할 것인가? ▫ Domain Events à Event-driven Architecture 도출 DDD for MSA Applicable Practices: ㄱ. 이벤트 스토밍과 BPMN: 이벤트, 커맨드, 액터, 어그리게이트 식별 ㄴ. UML 과 컨텍스트 맵: 보편언어, 바운디드 컨텍스트 식별
  • 80. DDD: Domain Object Classifications 66 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.
  • 81. Event Storming: DDD 를 쉽게하는 방법 ▪이벤트스토밍은 시스템에서 발생하는 이벤트를 중심 (Event-First) 으로 분석하는 기법으로 특히 Non-blocking, Event-driven 한 MSA 기반 시스템을 분석에서 개발까지 필요한 도메인에 대한 탁월하게 빠른 이해를 도모하는데 유리하다. ▪기존의 유즈케이스나 클래스 다이어그래밍 방식은 고객 인터뷰나 엔티티 구조를 인지하는 방식과 다르게 별다른 사전 훈련된 지식과 도구 없이 진행할 수 있다. ▪진행과정은 참여자 워크숍 방식의 방법론으로 결과는 스티키 노트를 벽에 붙힌 것으로 결과가 남으며, 오랜지색 스티키 노트들의 연결로 비즈니스 프로세스가 도출되며 이들을 이후 BPMN과 UML 등으로 정재하여 전환할 수 있다. vs.
  • 82. 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
  • 83. Event Flows: Timeline-based Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­ systems-­with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 84. 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
  • 85. Decomposing Mi-Svc : Finding Aggregate Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­ systems-­with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 86. Decomposing Mi-Svc : Bounded Contexts Source:  https://blog.redelastic.com/corporate-­arts-­crafts-­modelling-­reactive-­ systems-­with-­event-­storming-­73c6236f5dd7,  Kevin  webber
  • 87. How to implement (if green-field) • Event  à Event  Domain  Class  by  Java • Aggregate  à Cluster  of  JPA  Entities • Command  à Spring  Data  Rest  will  generates  the   REST-­based  Services • Policy  à JPA  Entity’s  Lifecycle  Hook  or  CDC • Document  à Polyglot  Data  Model
  • 88. How to implement (if brown-field) • Events  Extracted  from  Legacy  Systems • Lifecycle  Hook  or  CDC • New  Service  subscribing  the  key  events • New  functions  are  coded  in  new  service
  • 89. Lab Time – Event 들을 먼저 도출 과정이등록됨 강의가등록됨 강사가매핑됨 수강이신청됨 강의일정변경 됨 강의가 취소됨 수강승인됨 지불요청됨 우리 서비스에는 어떤 비즈니스이벤트들이 발생하는가? 현업이 사용하는 용어를 그대로사용 (Ubiquitous  Language) 용어의 namespace  를 구지 나누려는노력을하지 않음
  • 90. Lab Time – Policy 도출 과정이등록됨 강의가등록됨 강사가매핑됨 수강이신청됨 강의일정변경 됨 강의가 취소됨 수강승인됨 지불요청됨 어떤 이벤트에 이어서 곧바로 항상 발생해야하는 업무규칙 구현상에서는 이벤트의 Publish에 따라 벌어지는 이후의프로세스가자동으로트리거 되게 함 축하메시 지발송 강사달력 에 추가 취소 안내메일 발송 변경 안내메일 발송
  • 91. Lab Time – Command 도출 (쓰기행위) 과정정보 입력 강의정보 입력 강사매핑 수강정보 등록 일정변경 Event를 발생시키는 명령은무엇인가? UI를 통해?  or  시간도래? or  다른 이벤트에 의해? Command  는 어떠한 상태의 변화를 일으키는서비스를 말함. *  Command 라는 용어는 CQRS  에서 유래했으며, 쓰기서비스인Command  와 읽기행위인Query는구분됨. 강의취소 과정이등록됨 강의가등록됨 강사가매핑됨 수강이신청됨 강의일정변경 됨 강의가 취소됨 수강승인됨 지불요청됨 축하메시 지발송 강사달력 에 추가 취소 안내메일 발송 변경 안내메일 발송
  • 92. Lab Time – Aggregate 도출 (데이터모델) 도메인 이벤트가 발생하는데는, 어떠한 도메인 객체의변화가 발생했기 때문이다. 하나의 ACID  한 트랜잭션에 묶여 변화되어야 할 객체의묶음을 도출하고,그것들을커맨드, 이벤트와함께 묶는다. 수강승 인 과정정 보입력 강의정 보 입력 강사매 핑 수강신 청 일정변 경 강의취 소 강의가등록 됨 수강이신청 됨 강의일정변 경됨 강의가 취소됨 수강승인됨 지불요청됨 강사가매핑 됨 과정이등록 됨 강의 (Clazz) 과정 (Course) 수강 (Enrollment) 축하메 시지발 송 강사 달력 에 추가 취소 안내메 일 발송 변경 안내메 일 발송 일정추 가 일정이 추가됨 일정 노티발 송 노티이력
  • 93. Lab Time – Bounded Context 도출 수강승 인 과정정 보입력 강의정 보 입력 강사매 핑 수강신 청 일정변 경 강의취 소 강의가등록 됨 수강이신청 됨 강의일정변 경됨 강의가 취소됨 수강승인됨 지불요청됨 강사가매핑 됨 과정이등록 됨 강의 (Clazz) 과정 (Course) 수강 (Enrollment) 축하메 시지발 송 강사 달력 에 추가 취소 안내메 일 발송 변경 안내메 일 발송 일정추 가 일정이 추가됨 일정 노티 노티이력 개념적: • Bounded  Context  는 동일한 문맥으로 효율적으로 업무 용어 (도메인 클래스)를 사용할 수 있는 객체범위를 뜻한다. 하나의 BC  는 하나이상의 어그리게잇을 원소로 구성될 수 있다. BC를 Microservice 구성단위로 정하게 되면 이를 담당한 팀 내의 커뮤니케이션이 효율화된다. 구현관점: • 어그리게잇은 ACID  트랜잭션 범위이기도 하기때문에 이를 더 쪼개서 BC  를 구성할 수는 없다. BC  내의 어그리게잇들에 대한 보존 (Persistence)은 아마도 그 목적에 맞는 최적화된 데이터모델을 독립적으로 설계하고 구현할 수 있다. 과정개발 강의관리 달력 마케팅 수강관리
  • 94. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 95. 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 81 비즈니스 로직 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
  • 96. 82 ▪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)
  • 97. 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 83
  • 98. Step 1: Applying Hexagonal Architecture 과정정보입 력 과정이등록됨 과정 (Course)  domain  model 과정개발 과정 (Course) Message consumer Message producer DAO ControllerBrowser Message  broker 과정정보 입력 과정이 등록됨 Repository interface 커맨드 외부 도메인이벤트 도메인이벤트 Database
  • 99. Step 2: Applying MSA Chassis  MSA  chassis   Spring  Boot  /  Cloud 과정 (Course) 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
  • 100. MSA Chassis : Spring Boot Spring Cloud 86 Well-­designed  MSADDD Applying MSA Chassis
  • 101. Spring Boot: A MSA Chassis 87 • 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
  • 102. Lab: Create a Spring boot application 88 Go  to  start.spring.io Set  metadata: -­ Group:  com.education -­ Artifact:  education -­ 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
  • 103. Running Spring Boot Application 89 $ 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
  • 104. Test Generated Services 90 $ 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
  • 105. Aggregate à Entity Class 작성 과정 강의 수강 @Entity public  class  Clazz{ @Id @GeneratedValue Long  id;; String  states;; int evaluationRate;; String  title;; @ManyToOne @JoinColumn(name=cid) Course  course;; } @Entity public  class   Course   { @Id @GeneratedValue Long   id;; String  title;; int duration;; String  description;; int maxEnrollment;; int minEnrollment;; Double   unitPrice;; @OneToMany(   cascade   =  CascadeType.ALL,   fetch   =  FetchType.EAGER,   mappedBy =  course) ListClazz  clazzes;; } @Entity public  class  Enrollment  { @Id @GeneratedValue Long  id;; @OneToOne Customer  customer;; }
  • 106. 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   SharedCalendarService { @RequestMapping(method   =  RequestMethod.GET,   path=/calendar/{instructorId}/{date}) Resources   getSchedules(@PathVariable(instructorId)   Long   instructorId,   @PathVariable(date)   String  date);; } public  interface   CourseRepository extends   PagingAndSortingRepositoryCourse,   Long   { ListCourse  findByTitleContaining(@Param(title)   String  title);; } 과정정보 C.R.U.D 강의정보 C.R.U.D 강사매핑 수강정보 C.R.U.D 일정변경수강취소 ….  등등등 지불 축하메시 지발송
  • 107. Main Class 93 @SpringBootApplication public  class  Application public  static  void  main(String[]  args)  { SpringApplication.run(Application.class,  args);; } }
  • 108. Test Generated Services 94 $ http localhost:8080 { _links: { clazzDays: { href: http://localhost:8080/clazzDays{?page,size,sort}, templated: true }, clazzes: { href: http://localhost:8080/clazzes{?page,size,sort}, templated: true }, courses: { href: http://localhost:8080/courses{?page,size,sort}, templated: true }, customers: { href: http://localhost:8080/customers{?page,size,sort}, templated: true }, instructors: { href: http://localhost:8080/instructors{?page,size,sort}, templated: true } } } HATEOAS  links
  • 109. Create new course 95 $ http localhost:8080/courses title=SOA duration=5 maxEnrollment=50 minEnrollment=10 { _links: { self: { href: http://localhost:8080/courses/1 } }, courseId: null, description: null, duration: 5, maxEnrollment: 5, minEnrollment: 1, title: SOA } URI  of  the  new  course
  • 110. Create a class of the course 96 $ http POST class-service:8080/clazzes date=“2018-12-5” course=http://course-service:8080/courses/1 $ http http://localhost:8080/courses/1/clazzes URI  of  the  SOA  course { _embedded: { clazzes: [ { _links: { self: { href: http://localhost:8080/clazzes/2 } }, evaluationRate: 0, states: null } ] }, Course  is  aggregation  root
  • 111. Mapping an instructor to the class 97 $ http http://localhost:8080/instructors firstName=진영 lastName=장” # 강사 등록 $ http http://localhost:8080/clazzDays clazz=http://localhost:8080/clazzes/3 date=2012-04-23T18:25:43.511Z” # 클래스의 일정 등록 # 다른 클래스 하나 더 생성 $ http localhost:8080/clazzes course=http://localhost:8080/courses/1 $ http http://localhost:8080/clazzDays clazz=http://localhost:8080/clazzes/5 date=2012-04-23T18:25:43.511Z” # 일정이 중복되는 강의로
  • 112. Mapping an instructor to the class 98 $ http PATCH http://localhost:8080/clazzes/3 instructor=http://localhost:8080/instructors/2 # 장진영 강사에게 첫 클래스를 지정 $ http PATCH http://localhost:8080/clazzes/5 instructor=http://localhost:8080/instructors/2 # 두번째 클래스는 같은 날에 있기 때문에 장진영 강사 일정이 중복되어 오류가 날 것. $ http http://localhost:8080/instructors firstName=상철 lastName=황” # 강사 2 등록 $ http PATCH http://localhost:8080/clazzes/5 instructor=http://localhost:8080/instructors/8 # 이 요청은 성공 해야 함. 황상철 강사는 일정이 가능하기 때문에...
  • 113. Enroll in the class and approve the enrollment 99 $ http localhost:8080/customers firstName=진영 lastName=장 #수강생 회원 등록 $ http localhost:8080/enrollments clazz=http://localhost:8080/clazzes/2 customer=http://localhost:8080/customers/3 #수강 예약 $ http http://localhost:8080/customers/3/enrollments #수강 목록 조회 $ http PATCH http://localhost:8080/enrollments/4 status=approved #수강 승인
  • 114. Not applicable to Entity / Repository ? use “Service” ▪ For Shared Calendar Service, this is not en entity ▪ In this case, we introduce ‘Service’ ▪ Define interface first by using JAX-RS (contract) ▪ Uses return type as “ResourceSupport” for HATEOAS link and loose coupling 100
  • 115. Create a Service Interface 101 public  interface  SharedCalendarService { @RequestMapping( method  =  RequestMethod.GET, path=/instructors/{instructorId}/schedule/{date}” ) ResourceSupport getSchedules( @PathVariable(instructorId)  Long  instructorId,   @PathVariable(dateStr)  String  dateStr );; }
  • 116. Create a Service Implementation 102 @Component public  class  SharedCalendarServiceImpl implements  SharedCalendarService { @Autowired ScheduleRepository scheduleRepository;; @Override public  ResourceSupportgetSchedules(Long  instructorId,  String  dateStr)  { ListSchedule  schedules  =  scheduleRepository.findByInstructorIdAndDate(instructorId,  date);; return  new  ScheduleResource(schedules);; } }
  • 117. Tip: Embedding HATEOAS links 103 If(clazz.getStatus().equals(OPEN)) add( linkTo( methodOn(EnrollService.class).enroll(clazz.getId()) ).withRel(”enroll) );; { … _links:  { ”enroll”:{“href”:  “http://localhost:8080/clazzes/1/enroll”} }) );; Code:   https://github.com/TheOpenCloudEngine/uEngine5-­ base/blob/master/process-­ service/src/main/java/org/uengine/five/service/InstanceResource.java
  • 118. 104 { _links: { “enrollIn: { href: http://localhost:9992/clazzes/2/enroll }, clazz: { href: http://localhost:9992/clazzes/2 }, clazzDays: { href: http://localhost:9992/clazzes/2/clazzDays }, course: { href: http://localhost:9992/clazzes/2/course }, instructor: { href: http://localhost:9992/clazzes/2/instructor }, self: { href: http://localhost:9992/clazzes/2 } }, evaluationRate: 0, states: wait-for-instructor }
  • 119. Monolothic 에서의 분산 트랜잭션 – 이슈없음 총수강신청시간: 500 총마일리지: 5 총수강신청시간 : 600 총마일리지: 6 Consistent In-­consistent 조회화면서비스구성 (모놀로씩) Clazz (MySQL) Client  (Web/Mobile) POST Enrollm ent Mileage 총수강신청시간 : 700 총마일리지: 7
  • 120. Nice but Too big (monolith) 106 JPA HATEOAS   API /courses/* /clazzes/* /instructors/* Service   Object Generated   by  Spring Repositories: CourseRepository ClazzRepository InstructorRepository H2 Entity Course Entity Clazz Entity Instructor Entity Schedule Entity Notification Entity Enrollment Entity YetAnother… …. Plan  to  add…
  • 121. 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,  IAM107 HATEOAS  API
  • 122. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 123. “ ▪From Monolith to Microservices 109 https://github.com/jinyoung/software-­modeling-­class-­management-­monolith à https://github.com/jinyoung/software-­modeling-­class-­management-­msa
  • 124. 5개의 눈금: 어느 굵기로 쪼갤 것인가? 그것이 문제로다… 110 Aggregate monolithminiBounded  context Business  Capability 최소 사이즈 – ACID  가 준수되어야 하는 원자적 단위 -­ 유연성이 높은 커뮤니케이션이 원활한 단위 – Separation  of   Concerns  이 좋은 비즈니스적 성과 측정과 피버팅이 용이한 단위 – 팀단위와 연결하기 좋은 구현이 용이한 단위 -­ 점진적 MSA   전환이 용이한 단위
  • 125. 데이터베이스를 어떻게 쪼갤 것인가? 그것도 문제로다… 111
  • 127. A Case: A Sub-domain = A Microservice = A Spring Boot App 113 Source: Alpha  Code:  https://www.youtube.com/channel/UCmbnw2hZFf6JzWICZIPe9cg
  • 128. Example of Context Map ▪ U: Up-stream ▪ D: Down-stream ▪ AR: Aggregation Root 114
  • 129. Lab Time – 마이크로서비스 도출 수강승 인 과정정 보입력 강의정 보 입력 강사매 핑 수강신 청 일정변 경 강의취 소 강의가등록 됨 수강이신청 됨 강의일정변 경됨 강의가 취소됨 수강승인됨 지불요청됨 강사가매핑 됨과정이등록 됨 강의 (Clazz) 과정 (Course) 수강 (Enrollment) 축하메 시지발 송 강사 달력 에 추가 취소 안내메 일 발송 변경 안내메 일 발송 일정추 가 일정이 추가됨 일정 메일 메일로그 강의관리 BC  와 수강관리 BC를 하나의 Micro-­Service  로 통합한 이유? • 강의 관리와 수강관리는 업무적으로 밀접하고 데이터 참조 관계가 깊다 • 아직까지 이 둘을 나눌 필요가 생길 수준으로 업무적/조직적 간섭이 크지 않다. 과정개발 강의/수강 관리 달력 마케팅 강의관리 수강관리
  • 130. Lab Time – Context Map 도출 개념적: • BC  간의 정보참조의 릴레이션, 혹은 이벤트가 발생한 이후의 동반된 행위의 호출의 관계를 선으로 표시함. Upstream  à Downstream  으로 정보가 내려가게 됨. 구현관점: • 자치적으로 구현설계가 이루어질 수 있는 BC  간에 커뮤니케이션을 위해서는 데이터의 적절한 변환이나 표준화, Pub/Sub  등의 커뮤니케이션 방법 및 데이터 전환에 대한 이슈가 발생하게 됨. 해당 이슈를 적절한 패턴을 선택하여 실제 연동을 위한 Adapter  를 개발해야 함. 수강승인 과정정보입 력 강의정보 입력 강사매핑 수강신청 일정변경 강의취소 강의가등록됨 수강이신청됨 강의일정변경됨 강의가 취소됨 수강승인됨 지불요청됨 강사가매핑됨 과정이등록됨 강의 (Clazz) 과정 (Course) 수강 (Enrollmen t) 축하메시지 발송 강사 달력 에 추가 취소 안내메일 발송 변경 안내메일 발송 일정이 추가됨 일정 메일로그 과정개발 강의수강관리 달력 U D Customer/Supplier  +  Sync Anti-­corruption  Layer  +  Mediator 일정추 가 Conformist  +  Choreography Legend: 마케팅
  • 131. Lab Time – Topology Consideration : 강의 정보 입력 강사 매핑 일정 변경 강의 취소 강의가 등록됨 강의일 정변경 됨 강의가 취소됨 강사가 매핑됨 강의 (Clazz) 강사 달력 에 추가 취소 안내 메일 발송 변경 안내메일 발송 일정이 추가됨 일정 메일로 그 강의관리 달력 라이락 스티커 (Policy)  를 어디에 둘 것인가? -­ Orchestration  or  Choreography?  Or  Mediation? 강의 정보 입력 강사 매핑 일정 변경 강의 취소 강의가 등록됨 강의일 정변경 됨 강의가 취소됨 강사가 매핑됨 강의 (Clazz) 일정이 추가됨 일정 메일로 그 강의관리 달력 축하 메시 지발 송 강사 달력 에 추가 취소 안내 메일 발송 변경 안내 메일 발송 일정 추가 메일 발송 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 마케팅 마케팅
  • 132. Ref: Relation types between services 118 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.
  • 133. Issues in transforming Monolith to Microservices Course (Mongo  DB) Marketing (File  Sys) Class (H2) SME (RDB) Calendar (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 Course Ent it y Clazz Ent it y Instructor Ent it y Schedule Ent it y Notification Ent it y Enrollment Ent it y YetAnother… REST  API REST  API API  Gateway 강 결합된 객체 참조 구조 Ent it y Topic
  • 134. Project Structure – Capstone Project 120 modules moduleshared-­model/module !-­-­ core  domain  -­-­ modulecourse/module moduleclazz/module modulecustomer/module !-­-­ supportive  domain  -­-­ modulecustomer/module modulecalendar/module !-­-­ general  services  -­-­ moduleproxy-­service/module moduleregistry-­service/module /modules Getting Code: $ git clone https://github.com/uengine-oss/msa- tutorial-class-management-msa.git
  • 135. Solutions – 객체의 분리 121 • 참조해야 할 도메인 클래스들의 공통화 à Shared  Kernel,  Maven  Repo  등을 통한 공통 모델의 공유 : 동일 언어인 경우 유리, 디펜던시 발생 à 혹은 중복 모델 개발 : Polyglot  인 경우 유리 • Entity  분리에 따른 원격 객체 (어그리게잇) 참조 à Primary  Key  를 통해서만 참조 à HATEOAS  link  를 이용
  • 136. Solutions – API 통합 122 • API  Gateway   à 진입점의 통일 à Path-­based  Routing  (기존에 REST  로 된경우 가능) • Service  Registry à API  Gateway  가 클러스터 내의 인스턴스를 찾아가는 맵
  • 137. Solutions – 이벤트의 퍼블리시 123 • 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
  • 138. Legacy Transformation – Strangler Pattern 124 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
  • 139. 마이크로 서비스간의 서열과 역학관계 125 1순위: Core  Domain 버릴 수 없는. 이 기능이 제공되지 않으면 회사가 망하는. 예) 쇼핑몰 시스템에서 주문, 카탈로그 서비스 등 2순위: Supportive  Domain 기업의 핵심 경쟁력이 아닌, 직접 운영해도 좋지만 상황에 따라 아웃소싱 가능한. 시스템 리소스가 모자라면 외부서비스를 빌려쓰는 것을 고려할만한 예) 재고관리, 배송, 회원관리 서비스 등 3순위: General  Domain SaaS  등을 사용하는게 더 저렴한, 기업 경쟁력과는 완전 무관한 예) 결재, 빌링 서비스 등 무엇을 우선적으로 챙길 것인가?
  • 140. 마이크로 서비스간의 서열과 역학관계 126 어느 마이크로 서비스의 인터페이스를 더 중요하게 관리할 것인가? 카탈로그 (core) 배송 SaaS (general,  외부서비스) 상품추천 (supportive) Core  Domain  간 (높은 서열끼리) 에는 Shared-­kernel  도 허용가능하다. 하지만, 중요도가 낮은 서비스를 위해 높은서열의 서비스가 인터페이스를 맞추는 경우는 없을 것이다. conformist Anti-­corruption 주문 (core) Shared-­kernel
  • 141. 마이크로 서비스간의 서열과 역학관계 127 마이크로서비스간 트랜잭션의 묶음을 어떻게 할 것인가? 재고 (core) 배송 상품추천 (supportive) 배송기사가 없다고 주문을 안받을 것인가? 상품 추천이 안된다고 주문버튼을 안보여줄 것인가? Core  Domain  간에는 강결합이 요구되는 경우가 생길 수 있다. 하지만 우선순위가 떨어지는 비즈니스 기능을 위해 강한 트랜잭션을 연결할 이유는 하등에 없다. UI  mashup Async Event-­driven Eventual  TX 주문 (core) ACID  TX (2PC)
  • 142. 마이크로 서비스간의 서열과 역학관계 128 손님이 많이 와서 집이 좁아졌다.. 무엇을 우선적으로 줄일 것인가? 주문 주문 배송 배송 상품 추천 주문 주문 주문 주문 상품 추천 배송서비스는 야간에 올라와서 후에 처리되어도 된다. 하지만 구매가 몰려드는 시간에 주문을 못받으면 배송은 의미가 없다
  • 143. 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,  IAM129 Loose  coupled  design  (HATEOAS  API,   Service  Decomposition)
  • 144. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 145. Integration Patterns 131 By Request-Response By Event-driven Architecture By UI
  • 146. “ 132 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
  • 147. 아마존 닷컴은 다양한 서비스 제공과 효율적인 운영 환경 전환을 위해 분산 서비스 플랫폼으로 전환 하였습니다. 2001년 아마존은 주요한 아키텍쳐 변화가 있었는데 기존 모놀리식(Monolitic)
  • 148.  기반에서 서로 다른 어플리케이션 기능을 제공하는 분산 서비스 플랫폼으로 변화 하였습니다. 현재의 Amazon.com의 첫 화면에 들어 온다면,
  • 149.   그 페이지를 생성하기 위해 100여개가 넘는 서비스를 호출하여 만들고 있습니다.
  • 150. Client-side Rendering : 장애 전파 회피 상품이미지 [주문버튼] 배너 상품추천 다음중 가능한 빨리 로딩되어야 하고, 문제가 없어야 할 화면 영역은? Server-­side  Rendering  은 모든 화면의 콘텐츠가 도달해야만 화면을 보여줄 수 있지만, Client-­ side  Rendering  은 먼저 데이터가 도달한 화면부터 우선적으로 표출할 수 있다. 광고배너가 나가지 못한다고 주문을 안받을 것인가? 그걸 원하지 않는다면 AJAX  /  MVVM  같은 Client-­side  Rendering  기술에 주목하자 1 2 3
  • 151. Microservice Integration with by UI ▪서비스의 통합을 위하여 기존에 Join SQL 등을 사용하지 않고 프론트-엔드 기술이나 API Gateway 를통하여서비스 간 데이터를 통합함 ▪프론트엔드에서 데이터를 통합하기 위한 접근 방법으로는 W3C 의 Web Components 기법과 MVVM 그리고 RESTAPI 전용 스크립트가 유용함
  • 152. W3C Web Components 136 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
  • 154. Frameworks supporting Web Components 138 • Provides  Cohesive  Component   Model • Component   Composition   by  HTML   markup • Dynamic  Data  Binding • Responsive  Web  by  Material   Design • Standard Polymer                             VueJS **  비표준: Angular  JS,  React
  • 155. User Interface Design 139 Responsive  Web Material  Design
  • 156. Custom tag for Domain Class: course tag 140 template div h1Course  Management/h1 course  v-­model=courses[index]  v-­for='(course,  index)  in  courses'   @change=updateCourse  @remove=removeCourse   @classes=jumpToClasses/course h2Add  New  Course/h2 course  v-­model=newCourse  editMode=true  isNew=true   @add=addCourse/course /div /template
  • 157. Custom Tag for Domain Class: class tag 141 template div h1Class  Management/h1 clazz v-­model=clazzes[index]  v-­for='(clazz,  index)  in  clazzes'   @remove=removeClazz/clazz clazz v-­model=newClazz  editMode=true  isNew=true  @add=addClazz/clazz /div /template
  • 158. Data binding to Domain Class Tags 142 script var courses  =  [];; var me  =  this;; backend.$bind(courses,  courses);; courses.$load().then(function(courses){ me.courses =  courses;;  //  set  the  view's  data  with  the  loaded  data  obtained  from  backend. });; /script course  v-­model=courses[index]  v-­for='(course,  index)  in  courses'   @change=updateCourse  @remove=removeCourse   @classes=jumpToClasses/course
  • 159. Tenant UI Customization (Composition) by Tag composition 143 Domain  HTML  Tags clazz course   instructor clazz-­day ….   Tenant  A Tenant  B Tenant  C
  • 160. 144 Oops! CORS Exception? Accessing  Multiple   Microservices from   outside
  • 161. 145 API Gateway: Edge Service Acting  like  “Skin”  to  access  our  services  : • Re-­Routes  to  multiple  services • Allows  CORS • Checks  ACLs • Prevent  DDOS  etc.
  • 162. API Gateway: Routing, Securing and Load-balancing 146 Front-­‐End API  GW  (ZUUL / Ingress) Clazz SME  1Course  1 EUREKA / Kube-­‐DNS http://abc.com/courses/** http://abc.com/clazzes/** http://abc.com/instructors/** Course-­service:  ip1,  ip2 Clazz-­service:  ip3 Sme-­service:  ip4,  ip5 Course  2 SME  2 Ip1:port1/instructors/** Ip2:port2/instructors/** Ip3:port3-­1/clazzes/** Ip4:port4-­1/smes/** Ip5:port5-­1/smes/** • Add  CORS  Header • Routes  to  actual  backend  service   • Load  Balancing • Fallback SME  3 Ip6:port6-­1/smes/** By  container  orchestrator  something
  • 163. 147 Configuring Netflix Zuul #application.yml (eureka) zuul: routes: courses: path:  /courses/** serviceId:  course stripPrefix:  false clazzes: path:  /clazzes/** serviceId:  clazz stripPrefix:  false #application.yml (kube-­DNS) zuul: routes: courses: path:  /courses/** url:  http://class-­course:8080 stripPrefix:  false clazzes: path:  /clazzes/** url:  http://class-­clazz:8080 stripPrefix:  false
  • 165. Microservice registration configuration 149 #application.yml spring: application: name:  clazz eureka: client: serviceUrl: defaultZone:  http://localhost:8761/eureka/ healthcheck: enabled:  true Who  Am  I 부트업 되면서 출생신고할 동사무소(유레카)주소
  • 166. Marking Self-registration 150 @SpringCloudApplication @EnableEurekaClient public  class  Application   { public  static  void  main(String[]  args)  { SpringApplication.run(Application.class,   args);; } }
  • 167. Running an Eureka server 151 @SpringBootApplication @EnableEurekaServer public  class  RegistryServiceApplication { public  static  void  main(String[]  args)  { …. } } #application.yml server: port:  8761 eureka: instance: hostname:  localhost client: registerWithEureka:  false fetchRegistry:  false serviceUrl: defaultZone:   http://${eureka.instance.hostname}:${server.port}/eureka/
  • 168. Running Registry and Proxy 152 1.  가장 먼저 실행할 것은 Registry  (Eureka  서버)임. [동사무소] 2.  다음으로 실행할 것은 Proxy  (Zuul서버) 임. [이정표 서비스] $ cd uengine-proxy-server/ $ mvn spring-boot:run $ cd uengine-registry-server/ $ mvn spring-boot:run
  • 169. Running Micro Services in local machine 153 2.  Run  and  test  Class  Service 1.  Run  and  test  Course  Service $ cd clazz-service/ $ mvn spring-boot:run –Dserver.port=8088 Launch another shell and confirm server is up: $ http localhost:8088/clazzes $ cd course-service/ $ mvn spring-boot:run –Dserver.port=8089 Launch another shell and check the server is up: $ http localhost:8089/courses
  • 170. Authenticating Microservices 154 Front-­‐end  or  3rd -­‐party  Apps API  GW  (ZUUL) Clazz SMECourse EUREKA /courses/** /clazzes/** /instructors/** IAM (Oauth token   provider) 1 2 3 • Request  Access  Token  with   Permission   scopes • Acquire  Access  Token   • Request  with  Token  (Header) • API  Gateway  validates   the  token • Easy  and  integrated   way  to  provide   APIs  for  3rd Party  Apps   Stateless  한 인증 정보 관리 Memory  사용 최적 Id/pwd Token   의 발행: • User:  장진영 • Scopes: 강의서비스 CRUD,  과정서비스 R 장진영 유저가 강좌 서비스에 CUD  메서드 호출시, API  GW  에서 Method   Not  Allowed   오류 출력
  • 171. 155 Zuul API Gateway for Security ▪ Authorizing Microservices with OAuth2 and PreFilter of Zuul zuul: routes: courses: path:  /courses/** serviceId:  course-­service stripPrefix:  false iam-­scopes: -­ course-­access/GET -­ course-­manage/PUT-­POST-­PATCH-­DELETE https://github.com/TheOpenCloudEngine/uEngine-­ cloud/blob/master/uengine-­cloud-­ zuul/src/main/java/org/uengine/zuul/pre/IAMFilter.java
  • 172. 156 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
  • 173. 157 Exposing New APIs ▪ Exposing New API from existing microservices ▪ For more complicated services, BPM can be another option zuul: routes: courses: path:  /courses/** serviceId:  course-­service stripPrefix:  false iam-­scopes: -­ catalog-­access/GET -­ catalog-­manage/POST-­PATCH-­DELETE
  • 174. Transaction Problem in UI composition 총수강신청시간 : 500 총마일리지: 5 총수강신청시간 : 600 총마일리지: 5 총수강신청시간 : 600 총마일리지: 6 총수강신청시간 : 700 총마일리지: 6 Consistent In-­consistent 조회화면서비스구성 (클라이언트가 순차 호출) Mileage (MongoDB) Clazz (MySQL) Client  (Web/Mobile) POST (성공시) -­à POST
  • 175. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 176. “ 160 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
  • 177. 서비스의 호출 방식 2가지 ▪ 외부에서 161 마이크로 서비스 간 (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  에 따른 서비스가 라우팅
  • 178. Inter-microservices Call – Request/Response 162 Front-­‐end API  GW  (ZUUL) ScheduleCalendar Clazz Course EUREKA / Kube-­‐DNS Course:  ip1,  ip2 Clazz:  ip3 ScheduleCalendar:  ip4,  ip5 Ribbon  / Envoy   sidecar Zuul을 경유하지 않고 직접 내부 IP   로 접근
  • 180. Consumer Code: Clazz 164 @Entity public  class  Clazz { @Autowired SharedCalendarService sharedCalendarService;; @PrePersist public  void  beforeSave()  { if(getInstructor()!=null){ if(getClazzDays()==null) throw  new  RuntimeException(Instructor  can  be  mapped   after  adding   class  days  for  this  class.);; for(ClazzDay clazzDay :  getClazzDays()){ ListClazzDay  schedules  =  sharedCalendarService.getSchedules(clazzDay.getDate(),  getInstructor());; if(schedules!=null    schedules.size()    0){ throw  new  RuntimeException(Instructor    +  getInstructor().getFirstName()  +    already  have  another  class  for  that  time  slot.);; } } } } }
  • 181. Service Interface: mark as @FeignClient - EUREKA 버전 165 -­-­-­-­ Service  Id 이걸로, Autowired 시에 식별됨 @FeignClient(calendar) public  interface  SharedCalendarService { @RequestMapping(method   =  RequestMethod.GET,  path=/calendar/{instructorId}/{date}) Resources  getSchedules(@PathVariable(instructorId)  Long  instructorId,  @PathVariable(date)  String  date);; }
  • 182. Service Interface: mark as @FeignClient - Kube-DNS 버전 166 -­-­-­-­ url이 부여되면 우선으로 url을 직접호출함 @FeignClient(name  =  calendar-­service”,  url=“http://calendar-­service:8080”) public  interface  SharedCalendarService { @RequestMapping(method   =  RequestMethod.GET,  path=/calendar/{instructorId}/{date}) Resources  getSchedules(@PathVariable(instructorId)  Long  instructorId,  @PathVariable(date)  String  date);; }
  • 183. Issues in Request-Response model 서비스구성 (Request-­Response,  Sync  호출) Mileage (MongoDB) Clazz (MySQL) Client  (Web/Mobile) POST POST Yet  Another  SVC (NoSQL) POST • 성능저하 • 장애전파 • 트랜잭션 처리를 위한 2PC  구현
  • 184. 장애전파 차단: 서킷브레이커 패턴 168 Client Circuit breaker Supplier Connection problem timeouttimeout timeouttimeout trip Circuit  open 장애 감지 시, 차단기 작동(Open) 일시 동안 Fallback으로 서비스 대체 일부 트래픽으로 서비스 정상여부 확인 정상 확인 시, 차단기 해제(Close)
  • 185. “ 169 Service Composition by Event-driven Model ▪ Event-driven Approach ▪ ACID Tx. vs Eventual Tx. ▪ Business Transaction / Compensation (Saga) Pattern
  • 187. Inter-microservice Call - Event Publish / Subscribe (PubSub) 171 Course Clazz Calendar pub (과정기획일정, 2018-­3-­5) pub (강의일정, 2018-­3-­6) Event  Queue  (i.e.  Apache  Kafka) sub 2018-­3-­6 OOO   OOO 2018-­3-­5  XXX  XXXXX ….
  • 188. Event Consumer: calendar 172 @Component public  class  EventListener { /**  version  1.  callback  version  **/ @StreamListener(Streams.INPUT) public  void  handleClazzDay(@Payload  ClazzDayRegistered clazzDayRegistered)  { System.out.println(Received:  +  clazzDayRegistered.getDate());;  //  일정 db 에 저장. } }
  • 189. Event Publisher 173 @Entity public  class  ClazzDay{ …   @PrePersist public  void  publishEvent()  throws  JsonProcessingException { Streams  streams  =  Application.getApplicationContext().getBean(Streams.class);; MessageChannel messageChannel =  streams.outboundChannel();; messageChannel.send(MessageBuilder .withPayload(new  ClazzDayRegistered(this))          //  POJO  를 그대로 보낸다. .setHeader(MessageHeaders.CONTENT_TYPE,  MimeTypeUtils.APPLICATION_JSON) .build());; System.out.println(Event  published);; } }
  • 190. Distributed Transaction Issues 174 Eventual  Transaction  /  compensationAtomic  Transaction  /  2PC
  • 191. Eventual TX를 통한 분산 트랜잭션 처리 총수강신청시간 : 500 총마일리지: 5 총수강신청시간 : 600 총마일리지: 5 총수강신청시간 : 600 총마일리지: 6 총수강신청시간 : 700 총마일리지: 6 총수강신청시간 : 700 총마일리지: 7 Consistent In-­consistent 조회화면서비스구성 (Eventual  TX) Mileage (MongoDB) Clazz (MySQL) Kafka Enrolled (pub) Enrolled (sub) Client  (Web/Mobile) POST
  • 192. 여기서 선택의 길을 만남 • 내 서비스에서 데이터 불일치가얼마나 미션크리티컬한가? • 크리티컬 하다고 응답한다면, 내 서비스의 성능과확장성에비하여 크리티컬 한가? • 성능과 확장성 보다 크리티컬 하다면, 성능과 확장성을 포기할 수 있는가? • 성공한 내 서비스의 경쟁자들은무엇을 포기했는가? • è 강력한 의사결정 필요 (무엇으로 태어날것인가…)
  • 193. Eventual TX – 불일치가 Mission Critical 한 경우 총수강신청시간 : 500 총마일리지: 5 총수강신청시간 : 600 총마일리지: 5 (PENDING) 총수강신청시간 : 600 총마일리지: 6 총수강신청시간 : 700 총마일리지: 6  (PENDING) 총수강신청시간 : 700 총마일리지: 7 Consistent In-­consistent 조회화면서비스구성 (Eventual  TX) Mileage (MongoDB) Clazz (MySQL) Kafka Enrolled (pub,  PENDING) Enrolled (sub) Client  (Web/Mobile) POST All-­done (pub) All-­done (sub,  CLEAR  PENDING)
  • 194. Eventual TX – Rollback (Saga Pattern) 총수강신청시간 : 500 총마일리지: 5 총수강신청시간 : 600 총마일리지: 5 (PENDING) 총수강신청시간 : 600 총마일리지: 6 총수강신청시간 : 700 총마일리지: 6  (PENDING) 총수강신청시간 : 700 총마일리지: 7  à 취소됨 Consistent In-­consistent 조회화면서비스구성 (Eventual  TX) Mileage (MongoDB) Clazz (MySQL) Kafka Enrolled (pub,  PENDING) Enrolled (sub) Client  (Web/Mobile) POST All-­done (pub) CANCELLED (sub,  DELETE  or  CANCEL) CANCELLED (pub) If~else 총수강신청시간 : 600 총마일리지: 6
  • 195. Resources on Sagas ▪ http://eventuate.io/ ▪ https://vladmihalcea.com/how-to-extract-change- data-events-from-mysql-to-kafka-using- debezium/?fbclid=IwAR33Spb4jPBNI6VNHuCxdu_ BxpWdzOLzMvbCtHHvJrRmJPfiEoXwM1qWYBs 179
  • 196. “ 180 Data Query (Projection) in MSA ▪ Issues: Existing Join Queries and Performance Issues ▪ Composite Services or GraphQL ▪ Event Sourcing and CQRS
  • 197. 분산서비스에서의 Data Projection Issue 181 Order id  :  3492-­2323 restaurant   :  Ajanta Ticket 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  ServiceKitchen   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
  • 198. Data Projection by UI and HATEOAS 182 Order id  :  3492-­2323 restaurant   :  Ajanta _links:{ ticket:     http://tickets/3492-­ 2323 delivery:   http://deliveries/45-­ 4545 bill:  http://bills/343-­ 45611 } Ticket 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  ServiceKitchen   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
  • 199. Data Projection by Composite Service or GraphQL 183 Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018 ≪aggregate≫ Charge Accounting   Service ≪aggregate≫ Delivery Delivery  Service ≪aggregate≫ RestaurantOrder Kitchen   Service ≪aggregate≫ Order Order  Service Find  Order Composer GET/orders/ {orderId} GET/tickets?   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
  • 200. 생각을 다르게 하자 : CQRS and Event-Sourcing 184 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
  • 201. CQRS 의 확장 : Multiple Event Sources 185 Order  Service Kitchen   Service Delivery   Service Accounting   Service Order  Service Order  history view   database Order Events Ticket Events Delivery Events Accounting Events findOrderHistory(  ) findOrder(  ) Event handlers (Materialized  View) Modified  from  MicroservicesPatterns,  Chris  Richardson,  Manning,  2018
  • 202. CQRS 의 확장 : Multiple Event Sources and Multiple Read Models 186 장점: 현존 가장 최적의 Microservice 를 위한 분산 데이터베이스 모델임 1. 서비스별 최적화된 데이터모델 2. 다양한 데이터베이스/저장소 기술 선택 데이터베이스 (Polyglot  Persistency) 3. Maximum  Loosely-­coupled Design 4. 새로운 서비스 확장에 완전한 Open è 이를 위하여 발생하는 모든 주요 비즈니스이벤트를 Publish  하는 이벤트 소싱의 처리와 이벤트 포맷의 표준화가 필요
  • 203. Lab: CQRS with Kafka 187 ▪수강생 대시보드 구현 요구사항: ▫Real-time and Reactive User Interfaces ▫노티 ▫강사와 메시징 기반 질의응답 ▪Long-Running Processes: ▫수강신청 ▫승인/반려 ▫결제 ▪Multi-dimensional Views ▫수강진행률 ▫과정별/강사별/항목별 강의 조회 ▪Massive / web-scaled data ▫강의수강 패턴 분석 ▫다음 강의 추천
  • 204. CRQS with Kafka 188 1 Enrolled   100  hour   for   customer1 2 Approved   the   enrollment   1 3 Enrolled 50   hour  for   customer2 4 Cancelled   Enrollment   2 5 Class   Attended   for   Enrollment   2 6 Payment   Done  for   Enrollment   2 7 Enrolled  50   hour  for   customer4 8 … 9 … 수강신청 캘린더 Kafka Event  ConsumersFront-­end  (MVVM) Cache   (Redis) 대시보드 마케팅 Early   Warning (KSQL) 대시보드UI Push   Service (SSE   Emitter) 결제 pub sub sub pub sub sub subsub
  • 205. CQRS with Kafka 189 1 Enrolled   100  hour   for   customer1 2 Approved   the   enrollment   1 3 Enrolled 50   hour  for   customer2 4 Cancelled   Enrollment   2 5 Class   Attended   for   Enrollment   2 6 Payment   Done  for   Enrollment   2 7 Enrolled  50   hour  for   customer4 8 … 9 … 수강신청 캘린더 Kafka Event  ConsumersFront-­end  (MVVM) Cache   (Redis) 대시보드 마케팅 Early   Warning (KSQL) 대시보드 UI Push   Service (SSE   Emitter) 결제 pub sub sub pub sub sub subsub 수강이 신청됨 수강이 승인됨 수강완료함 지불완료됨 축하메시 지발송 총 수강시간 변경 취소 안내메일 발송
  • 206. Event Sourcing 1 2 3 4 5 6 7 8 9 Append  the  “Changes”  only Kafka 1:      key:  account1,  value:  {  action:  수강신청,  course:  123,  time:  100  } 2:      key:  account1,  value:  {  action:  승인,  course:  456,  time:  50  } 3:      key:  account2,  value:  {  action:  수강완료,  course:  123,  time:  50  } 4:      key:  account2,  value:  {  action:  결재완료,  course:  678,  time:  50  } 5:      key:  account1,  value:  {  action:  수강신청,  course:  789,  time:  50  } 6:      key:  account3,  value:  {  action:  반려,  course:  123,  time:  100  } ….
  • 207. Kafka custo mer Total enrolle d  time 1 100 custo mer Total enrolle d  time 1 150 custo mer Total enrolle d  time 1 150 2 50 custo mer Total enrolle d  time 1 150 2 0 custo mer Total enrolle d  time 1 100 2 0 custo mer Total enrolle d  time 1 100 2 0 3 50 custo mer Total enrolle d  time 1 100 2 0 3 50 4 50 Read Model for Dashboard 1 Enrolled   100  hour   for   customer1 2 Enrolled 50   hour  for   customer1 3 Enrolled 50   hour  for   customer2 4 Cancelled   50  hour  for   customer2 5 Cancelled 50  hour  for   customer1 6 Cancelled   50  hour  for   customer3 7 Enrolled  50   hour  for   customer4 8 … 9 … 총 수강시간 Table
  • 208. 1  minlater 2  min  later 3  min  later 4  min  later 5  min  later 6  min  later 7  min  later Snack  bar   pops  up Your  Total   Enrollment  Is 100  hr You’ve   enrolled  50   hour Undo Your  Total   Enrollment  Is 150  hrYou’ve   enrolled  50   hour Undo Your  Total   Enrollment  Is 100  hr You’ve   cancelled  50 Undo Your  Total   Enrollment  Is 200  hr You’ve   enrolled  50 Undo Your  Total   Enrollment  Is 50  hr You’ve   cancelled  50 Undo Read Model for Front-end (Push service) 1 Enrolled   100  hour   for   customer1 2 Enrolled 50   hour  for   customer1 3 Enrolled 50   hour  for   customer2 4 Cancelled   50  hour  for   customer2 5 Cancelled 50  hour  for   customer1 6 Cancelled   50  hour  for   customer3 7 Enrolled  50   hour  for   customer4 8 … 9 …Kafka
  • 209. 1  second  later 2  second  later 3  second  later 4  second  later 5  second  later 6  second  later 7  second  later 서두르세요! 수강신청률이 저조합니다.   **  Using  KSQL  or  Kstreams: Read Model for Real-time Analytic 1 Enrolled   100  hour   for   customer1 2 Enrolled 50   hour  for   customer1 3 Enrolled 50   hour  for   customer2 4 Cancelled   50  hour  for   customer2 5 Cancelled 50  hour  for   customer1 6 Cancelled   50  hour  for   customer3 7 Enrolled  50   hour  for   customer4 8 … 9 …Kafka
  • 210. 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,  IAM194
  • 211. “ Table of Content Microservice and  SOA   Programming+Microservice-­Based DevOps  Project 1. Review  for  the  Domain  Problem:    A  Public  Education  Service 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
  • 212. “ 196 DevOps ▪ DevOps Process and Tools ▪ Deploy Strategies ▪ Containers and Orchestrators ▪ Cloud Foundry, Bluemix, and Kubernetes https://www.youtube.com/watch?v=_I94-­tJlovg
  • 213. Process Change: 열차말고 택시를 타라! 197 모노리식 개발 및 운영환경 • 모노리식 환경하에서는 큰 개발팀이 하나의 소스코드레파지토리에 변경 사항을 커밋하므로 코드간 상호 의존도가 높아 신규 개발 및 변경이 어려움 • 작은 변경에도 전제를 다시 테스트/ 배포하는 구조이므로통합 스케줄에 맞춘 파이프 라인을 적용하기가 어렵고 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
  • 214. Process Change: Consumer-driven Test 198 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 한후에 제공자측에서 테스트가 생성되어 테스트가 벌어진다.
  • 216. CI/CD Tools – conventional CI/CD 200 ❑ 잦은 배포 ❑ 일반 서버에 배포 ❑ 테스트 자동화/커버리지 ❑ 도구: Jenkins,  Travis,  Gitlab 등
  • 217. CI/CD Tools – Container-based 201 ❑ Immutable  Image ❑ API  Testing ❑ Blue/Green,  Canary ❑ 도구: Jenkins  +  Docker  +  Spinnaker  +  Helm  +  Kubernetes à 매우복잡
  • 218. CI/CD Tools - Serverless 202 ❑ Infrastructure  As  A  Code ❑ Application  Configuration  과 Infra Configuration을 하나의 설정에 통합 ❑ 단일 도구
  • 219. Smart Deploy Strategies ▪ https://thenewstack.io/deployment-strategies/ ▪ Recreate: Version A is terminated then version B is rolled out. ▪ Ramped (also known as rolling-update or incremental): Version B is slowly rolled out and replacing version A. ▪ Blue/Green: Version B is released alongside version A, then the traffic is switched to version B. ▪ Canary: Version B is released to a subset of users, then proceed to a full rollout. ▪ A/B testing: Version B is released to a subset of users under specific condition. ▪ Shadow: Version B receives real-world traffic alongside version A and doesn’t impact the response. 203
  • 221. 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
  • 222. Production Debugging Tools (APM) ▪ Zipkin ▪ Pinpoint ▪ Elasticsearch ELK 206
  • 223. Lab: Running Micro Services in Docker 207 Executable  Jar Docker  Image (template) Docker  Registry (referenceable   by  image  name) Source  Code mvn package  -­B Docker  pushdocker build
  • 224. Running apps anywhere and reliably ▪ 개발, 스테이징, 운영에서 최대한 동일하게 동작하기 위해서는 ▫ 죽였다 살려내면 복구되는 (Immutable Image) ▫ 어디서나 실행되는 ▫ 그러면서 가벼운 환경
  • 225. Dockerfile: 도커 이미지 스크립트 #  기반 이미지 FROM  openjdk:8u111-­jdk-­alpine # 볼륨 연결 VOLUME  /tmp # 애플리케이션 복사 ADD  /target/*.jar   app.jar # 포트노출 EXPOSE  8080 # 자바 실행 ENTRYPOINT  [java,-­Xmx256M,-­jar,/app.jar] 209
  • 226. Lab time: Create and push Docker images $  cd  course-­service $  docker build  -­t  gcr.io/projectId/course:v1    . $  docker push  gcr.io/projectId/course:v1   … $  cd  ../clazz-­service $  docker build  -­t  gcr.io/projectId/clazz:v1    . $  docker push  gcr.io/projectId/clazz:v1   … $  cd  ../shared-­calendar-­service $  docker build  -­t  gcr.io/projectId/shared-­cal:v1    . $  docker push  gcr.io/projectId/shared-­cal:v1   210
  • 227. Lab time: Run the app with Docker docker run -p 8080:80 gcr.io/projectId/course 211
  • 228. Lab time: Basic Commands https://docs.docker.com/get-­started/part2/#recap-­and-­cheat-­sheet-­optional 212
  • 229. “ 213 Container Orchestration with Kubernetes ▪ Kubernetes Object Model ▪ Users to Pods: Services, Kube-proxy, Service Discovery, ServiceType ▪ Deploying Stand-Alone Application ▪ Liveness and Readiness ▪ Kubernetes Volume Management ▪ Multi-Tier Application https://www.youtube.com/watch?v=gauOI0O9fRMfbcli d=IwAR2y8nBOfi0ehHysOx-­ MtxSzDXzpv77sWnBg_pUEyIprE2fpMYuxBl3spq8
  • 231. Kubernetes: 발음하기 215 미국식: 큐브네리스 영국식: 쿠버네티스 인도식: 꾸-­버네띡스
  • 232. Container-based Application Design 216 https://kubernetes.io/blog/2018/03/principles-­of-­container-­app-­design/?fbclid=IwAR2oMrdP0d1Q6LXebtxNPnt-­RS5DIlkCIwpaMSL5mmW7VMaQb6hRV8hkd38
  • 233. 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
  • 234. 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
  • 235. Kubernetes Object Model ▪ apiVersion : mentions the API endpoint on the API server which we want to connect to. ▪ kind : mentions the object type – example has Deployment. ▪ metadata : has the basic information to objects, like the name. ▪ spec (spec and spec.template.spec) : defines the desired state of the deployment. In our example, we want to make sure that, at any point in time, at least 3 Pods are running, which are created using the Pods Template defined in spec.template. ▪ spec.template.spec : defines the desired state of the Pod. The example Pod would be created using nginx:1.7.9. Once the object is created, the Kubernetes system attaches the status field to the object apiVersion:  apps/v1 kind:  Deployment metadata: name:  nginx-­deployment labels: app:  nginx spec: replicas:  3 selector: matchLabels: app:  nginx template: metadata: labels: app:  nginx spec: containers: -­ name:  nginx image:  nginx:1.7.9 ports: -­ containerPort:  80 Deployment  object  Example
  • 236. Google Kubernetes Engine 220 SSH  접속 설정 파일 및 소스코드 편집 SSH  – 모든 명령 기본 설치
  • 238. 동의 몇가지 동의에 체크한 후, 계속하기클릭
  • 239. 카드입력 카드 번호 입력 (유저 밸리데이션 목적)
  • 242. 프로젝트 생성 자동생성된 프로젝트ID  를 사용 X (“수정” 클릭) 프로젝트 ID  입력 (글로벌리 유일한 ID)
  • 243. 쿠버네티스 클러스터 생성 상단의 이 버튼 클릭 웹브라우저용 SSH  콘솔이 생김
  • 244. 쿠버네티스 클러스터 생성 상단메뉴 Kubernetes  Engine     클러스터 선택
  • 245. 쿠버네티스 클러스터 생성 클러스터 명을 적절히 주고, Zone  = us-­central1-­a Region  = us-­central1 Node  =  3 로 설정
  • 246. 혹은, 콘솔에서 ▪gcloud config set compute/zone us-central1-a ▪gcloud config set compute/region us-central1 gcloud container clusters create my-first-cluster 스크립트 주소: https://github.com/TheOpenCloudEngine/uEngine-­cloud/wiki/Kubernetes-­ %EC%8B%A4%EC%8A%B5-­%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8
  • 248. Lab Time: 기본적인 kubectl명령어 ▪객체 목록 불러오기 ▫ “kubectl get [객체 타입]“ Ex) kubectl get pods : pod 목록 불러온다. ▪객체 삭제하기 ▫ “kubectl delete [객체 타입] [객체 이름]” Ex) “kubectl delete pods wordpress-5bb5dddcff-kwgf8” ▫ “kubectl delete [객체타입,객체타입,…] --all“ Ex) “kubectl delete services,depeloyments,pods –-all” - 실습 중에 잘못 생성되었거나 초기화가 필요할 경우 사용 ▪객체 상세 설명 확인하기 ▫ “kubectl describe [객체 타입] [객체 이름] ” Ex) “kubectl describe service wordpress”
  • 249. 이미지를 통한 어플리케이션 배포 • 현재 작동 중인 pod들이 없는지 확인 ▫ kubectl get pods ▪ Nginx이미지 예제로 배포하기 ▫ kubectl run first-deployment --image=nginx ▪ 실행된 Pods 확인 ▫ kubectl get pods (검색된 Pod의 이름을 복사한다. (각 pod들은 고유한 이름을 갖는다.)