Anzeige
Anzeige

Más contenido relacionado

Presentaciones para ti(20)

Similar a Safe cloud native transformation approaches(20)

Anzeige

Más de uEngine Solutions(20)

Anzeige

Safe cloud native transformation approaches

  1. 안정적 클라우드 네이티브 전환 전략 © 2019 uEngine solutions DevOps MSA DDD
  2. Mission: 프론트엔드 데이터베이스 Serv ice1 Serv ice2 Serv ice3 프론트엔드 데이터 베이스 Serv ice1 데이터 베이스 Serv ice2 데이터 베이스 Serv ice3 모놀리씩 마이크로서비스
  3. 목표 • Scalable • Resilient • Loosely Coupled • Independent Evolutionary • Technical Diversity
  4. 해결책 – Strangler Pattern ** Strangler: Legacy 전환 전략과 Emerging Service 개발 전략을 분리, 서서히 기존 서비스를 신 규 아키텍처로 전환해가는 변화관리 전략 신규 • 컨테이터 기반 • 이벤트 드리븐 • 서비스 매시 • 기능 관점 단위 (마이크로 or 나노) 레가시 • 최소한의 수정 • 이벤트 후킹 (Change Data Capturing) • VM 기반 미니서비스 (매크로) 범위를넓혀감 범위를줄여감
  5. Existing System 포탈 WAS 레가시1 (Java/ Tomcat) IIS 레가시2 (.NET)
  6. Lift and Shift - VM 포탈 WAS on VM 레가시1 (Java/ Tomcat) IIS on VM 레가시2 (.NET) IaaS
  7. New Service, New Architecture 포탈 WAS on VM 레가시1 (Java/ Tomcat) IIS on VM 레가시2 (.NET) IaaS API GW Event Queue CaaS (Kubernetes) container New Service (Python)
  8. Event Hook 포탈 WAS on VM 레가시1 (Java/ Tomcat) IIS on VM 레가시2 (.NET) IaaS API GW Event Queue pub pub hook CDC CaaS (Kubernetes) container New Service (Python) sub HTML REST e.g. 고객(테넌트)별 커스터마이징 요건
  9. HATEOAS API와 UI 주도 Data Aggregation
  10. Decomposing Monolith – Shared Database but Schema per service 프론트엔드 VM 레가 시1a (Java/ Tomcat) VM 레가 시2a (.NET) API GW IaaS CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) Event Queue
  11. containercontainer Materialized View or Schema per Service 프론트엔드 VM 레가 시1a (Java/ Tomcat) VM 레가 시2a (.NET) API GW IaaS CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) Event Queue
  12. Replacing Legacy 프론트엔드 VM 레가 시1a (Java/ Tomcat) VM 레가 시2a (.NET) API GW IaaS CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) Event Queue container 레가 시1a (Java/ Spring) CaaS (Kubernetes)
  13. 마이그래이션 전략 Strangler 프론트엔드 VM 레가 시1a (Java/ Tomcat) VM 레가 시2a (.NET) API GW IaaS CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) Event Queue container 레가 시1a (Java/ Spring) CaaS (Kubernetes)
  14. 마이그래이션 전략 Strangler 프론트엔드 VM 레가 시1a (Java/ Tomcat) VM 레가 시2a (.NET) API GW IaaS CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) Event Queue container 레가 시1a (Java/ Spring) CaaS (Kubernetes)
  15. 마이그래이션 전략 Strangler 프론트엔드 VM 레가 시1a (Java/ Tomcat) VM 레가 시2a (.NET) API GW IaaS CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) Event Queue container 레가 시1a (Java/ Spring) CaaS (Kubernetes)
  16. 마이그래이션 전략 Strangler 프론트엔드 VM 레가 시1a (Java/ Tomcat) VM 레가 시2a (.NET) API GW IaaS CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) Event Queue container 레가 시1a (Java/ Spring) CaaS (Kubernetes) Tested!
  17. 마이그래이션 전략 Strangler 프론트엔드 API GW CaaS (Kubernetes) container 레가 시1b (Java/ Spring) container 레가 시2b (Java/ Spring) container New Service (Python) container New Service (Go) container 레가 시1a (Java/ Spring) container 레가 시2a (Java/ Spring) IaaS Event Queue
  18. Legacy Issues • Stateful Session Data • Old-fashioned framework (JSP, SOAP, ORM …) • Old-WAS (Heavy-weight EJBs) • Join SQLs!
  19. 점진적 전환을 위한 기술들 -1 • API Gateway • Blue/Green & Canary Deployment • Dark Launch / Automated Test 개발자 확신, 문제 상황 대처
  20. 점진적 전환을 위한 기술들 -2 • Change Data Capturing • Materialized View 데이터 성능, 코드 전환 없는 연동
  21. MSA 구현 기술들 • 1세대 MSA (Spring Cloud / Netflix OSS) 코드수정 • 2세대 Service Mesh (Kubernetes / Istio) 코드수정X • 3세대 Event Driven MSA (Serverless / Kafka) 간섭최소화
  22. MSA 구현 기술들 비교 Spring Cloud / Netflix OSS Kubernetes / Istio Event Driven MSA (Kafka) 제공기능 API GW, Service Registry, Circuit Breaker … Covers all of Netflix OSS + Canary Deploy, Dark Launch … PubSub, Materialized View, Realtime Streaming Processing 코드 변경 필요 (only Java) 불필요 (Polyglot) N/A (with CDC) 서비스 간 커플링 Loosely-Coupled Loosely-Coupled 가장 Loosely-coupled 데이터 어그리게이션 성능 느림 (Blocked, Request- Response) 느림 (Blocked, Request- Response) 빠름 (Non-blocking, Event Sourcing)
  23. Service Mesh
  24. Microservices timeline
  25. K8S vs Spring Cloud vs Istio
  26. Advanced Routing & Deployment Strategy • Ingress / Egress Gateway • Canary Deploy • 특정 유저의 신상, 지역, 권한, 접근 단말에 따른 다른 버전의 노출 • AB Testing / Shadow Deploy (Dark Launch) • 신규 버전의 오류 노출 없는 실질적 테스트
  27. Advanced Resilience • Retry (Kubernetes X, Spring Cloud O) • 서비스간 호출의 실패에 대한 재시도 • Circuit Breaking (Spring Cloud O) / Rate Limiting • 인스턴스의 보호 • 전체 서비스 장애 차단 • Pool Ejection (Spring Cloud / Eureka) • 죽은 인스턴스의 제외 • Circuit Breaking + Pool Ejection + Retry = High Resilience
  28. Advanced Security • TLS based Inter-Mi-services Communication • By Auth (신규모듈) • Whitelist and Blacklist
  29. Advanced Observability • Distributed Tracing and Measure • 서비스간 호출의 내용 기록
  30. Spring Cloud + Netflix
  31. After Istio (on K8S) 좋은점: 1. L7 레이어를 사용, 성능이 높음 2. Code 변경 없이 Cross-cutting 이슈를 다루어줌 3. Polyglot 다양한 언어에 무관하게 적용가능 4. Main 서비스의 재배포 없이 Sidecar 를 관리 가능함
  32. Event Driven MSA
  33. Design Principle • Pluggable / Extensible Adapters and Views • Real-time Monitor (Push Service) • Usage Prediction, Billing • Multi-dimensional Analytic • Event-driven Microservices • Server-sent event • Stream Processing • Multiple Views / Polyglot Persistency
  34. 1 2 3 4 5 6 7 8 9 Service 1 Service 2 Legacy Event Producers ….. “Append only” pub Kafka Loosely-coupled Extensible and pluggable Event Sources Cache (Redis) DB (RDB?) Event Consumers Index (ElasticSear ch or Solr) sub Loosely-coupled Extensible and pluggable Views Service 1 (Java) Service 2 (Python) Legacy (Java) App polling containerSidecar  Front-end (MVVM) Load snapshot Offset: 9 Offset: 8 Offset: 6 Cache data again & Set offset as DB’s offset Read all again X 1. Web hoot or SSE Read faster / frequently via REST directly (no backend) Text search 1. . 2. HTTP Polling 3. CDC or file polling Pod Container …..Realtime Analytic (KSQL) Billing / Metering Offset: 9
  35. Event Formatting: Event Sourcing 1 2 3 4 5 6 7 8 9 Append the “Diff” only Kafka 1: key: account1, value: { action: Deposit, amount: 100 } 2: key: account1, value: { action: Deposit, amount: 50 } 3: key: account2, value: { action: Deposit, amount: 50 } 4: key: account2, value: { action: Withdraw, amount: 50 } 5: key: account1, value: { action: Withdraw, amount: 50 } 6: key: account3, value: { action: Deposit, amount: 100 } 7: key: account4, value: { action: Deposit, amount: 50 } ….
  36. 1 Deposit 100 for acc1 2 Deposit 50 for acc1 3 Deposit 50 for acc2 4 Withdraw 50 for acc2 5 Withdraw 50 for acc1 6 Deposit 50 for acc3 7 Deposit 50 for acc4 8 … 9 … Account Deposit Event Producers Kafka Cache (Redis) DB (RDB?) Event Consumers Index (ElasticSear ch or Solr) Front-end (MVVM) …..Billing (KSQL) Offset: 9 Backend for front …..SSE Emitter Offset: 9 Withdrawal
  37. Kafka Aggregate view in Database id balanc e acct1 100 1 Deposit 100 for acc1 2 Deposit 50 for acc1 3 Deposit 50 for acc2 4 Withdraw 50 for acc2 5 Withdraw 50 for acc1 6 Deposit 50 for acc3 7 Deposit 50 for acc4 8 … 9 … id balanc e acct1 150 id balanc e acct1 150 acc2 50 id balanc e acct1 150 acc2 0 id balanc e acct1 100 acc2 0 id balanc e acct1 100 acc2 0 acc3 50 id balanc e acct1 100 acc2 0 acc3 50 acc4 50
  38. Kafka View in Front-end (Push service) 1 minlater 2 min later 3 min later 4 min later 5 min later 6 min later 7 min later 1 Deposit 100 for acc1 2 Deposit 50 for acc1 3 Deposit 50 for acc2 4 Withdraw 50 for acc2 5 Withdraw 50 for acc1 6 Deposit 50 for acc3 7 Deposit 50 for acc4 8 Withdraw 50 for acc1 9 Deposit 150 for acc1 Snack bar pops up Your Balance Is 100 You’ve deposited 50 Undo Your Balance Is 150 You’ve deposited 50 Undo Your Balance Is 100You’ve withdrawed 50 Undo Your Balance Is 200You’ve Deposited 50 Undo Your Balance Is 50You’ve withdrawed 50 Undo
  39. Kafka View in Realtime Analytic (Early Warning) 1 second later 2 second later 3 second later 4 second later 5 second later 6 second later 7 second later Warning: You may go bankrupt after 5 min !!! ** Using KSQL or Kstreams: 1 Deposit 100 for acc1 2 Deposit 50 for acc1 3 Deposit 50 for acc2 4 Withdraw 50 for acc2 5 Withdraw 50 for acc1 6 Deposit 50 for acc3 7 Deposit 50 for acc4 8 Withdraw 50 for acc1 9 Deposit 150 for acc1
Anzeige