4. Cloud-Native Application
DevOps (SRE)
소프트웨어 전달과 인프라스트럭
처 변경 프로세스 자동화를 목표로
소프트웨어 개발자와 IT운영자가
협업, 신뢰성 있는 소프트웨어 생
성, 테스트, 릴리즈를 신속하게 자
주 진행할 수 있는 문화와 환경
Continuous Delivery
릴리스 작업을 단순하고 신뢰 가능
하게 만들어주므로 조직은 최종 배
포본이 비즈니스 프로세스와 엔터
프라이즈 경쟁력의 일부로 통합될
때까지 위험이 낮은 상황에서 자주
전달하고 최종 사용자로부터 빠르
게 피드백을 얻을 수 있다
Microservices
작은 서비스의 집합으로 애플리케
이션을 개발하는 아키텍처형 접근
법, 각 서비스는 비즈니스를 구현
하고 프로세스를 실행되면 API통신
한다.
Containers
운영시스템(OS)레벨의 가상화를
사용하여 하나 이상의 격리된 컨테
이너에 동적으로 분리되고, 각 컨
테이너는 고유의 프로세스와 리소
스 할당하고 높은 밀도로 결합된
컨테이너들를 개별 아이크로서비
스 배포수단으로 사용
● 속도와 안정성
● 협업 강화
● 문화
● 플랫폼 필요성 대두,
OnDemand Service
● SRE
● Agile
● 짧고 지속적 반복
● 지속적 통합/배포/제공
● 플랫폼/애플리케이션 배포
자동화
● API First
● 도메인 주도 설계
● 독립적 확장 가능
● 보다 빠르고 독립적인 배포
● 간편한 개발 및 유지관리
● Container Orchestration
● Self-containment
● Immutable Image
● Process Disposability
● Runtime Confinement
SRE : Site Reliability Engineering
5. 마이크로서비스의 특징
• 분리된 서비스들의 집합 (Componentization via Services)
• 비즈니스 능력에 따른 조직 구성 (Organized around Business Capability)
• 프로젝트가 아닌 프로덕트 (Products not Projects)
• 똑똑한 엔드포인트와 멍청한 파이프 (Smart endpoints and dumb pipes)
• 분산된 운영 방식 (Decentralized Governance)
• 인프라스트럭쳐 자동화 (Infrastructure Automation)
• 실패에 대비한 디자인 (Design for failure)
• 점진적 디자인 (Evolutionary Design)
6. Design Principle
- 높은 응집과 낮은 결합 (High Cohesion and Loose Coupling)
- 탄력적이고 확장 가능 (Resilience & Scalability)
- 높은 가시성과 관측성 (Observability)
• SOLID by Robert C. Martin (aka Uncle Bob) – 객체지향 개발 5대 원리
• 단일 책임의 원칙(Single responsibility principle): only changes to one part of the software’s spe
cification should be able to affect the specification of the class
• 개방폐쇄의 원칙(Open-closed principle): should be open for extension, but closed for modificati
on
• 리스코브 치환의 원칙(Liskov substitution principle): Object in a program should be replaceable
with instances of their subtypes without altering their correctness of that program
• 인터페이스 분리의 원칙(Interface segregation principle): Many client-specific interfaces are bett
er than one general-purpose interface
• 의존성역전의 원칙(Dependency inversion principle): One should depend upon abstractions, not
concretions
https://dzone.com/articles/cloud-native-container-design-principles
7. Domain-Driven Design
Event Storming (비즈니스 로직 단위로 분해)
Boris (분해된 각 단위가 어떻게 상호 작용하는 지 정의)
SnapE 분석 (분해된 각 단위의 API,
데이터 처리, 로직 등을 정의)
- Bounded Context
- Context Map
- Related Patterns
8. 12-Factor App - https://12factor.net/ko
코드베이스 종속성 설정 백엔드 서비스
빌드, 릴리즈, 실행 프로세스 포트 바인딩
동시성
(Concurrency)
폐기 가능
(Disposability)
개발/운영 환경 일치 로그 Admin 프로세스
https://12factor.net/ko/
9. 마이크로서비스 아키텍처 구성
• 설정 (Configuration)
• 서비스 등록 및 감지 (Service Registration and discovery)
• 서비스 게이트웨이 (Service Gateway)
• 서킷 브레이커 (Circuit Breakers)
• 분산 트레이싱 (Distributed tracing)
[ Service Registry ] [ Circuit Breaker ]
10.
11. Developing Service - Microframework
• Polyglot 은 꿈인가?
• Nodejs, Python, Go, Java, C#
• 프레임워크의 진화 à WAS의 종말
• Ktor
• Spark
• Micronaut
• javalin
• Spring WebFlux (former Spring Reactive Web)
fun main(args: Array<String>) {
val server = embeddedServer(Netty, port = 8080) {
routing {
get("/") {
call.respondText("Hello World!", ContentType.Text.Plain)
}
}
}
server.start(wait = true)
}
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
12. Non-Blocking
• Nodejs
• Vert.x
• Spring WebFlux
• RxJava, RxJs, Rx…..
• Coroutine for Kotlin
• Blocking persistence API (ex. Jdbc)
• Non-blocking nosql db (r2dbc : Reactive Relational Database Connectivity)
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
13. Scale to Zero / Functional
• GraalVM – Native-image
• Kotlin/Native
• Spring Fu (Kofu / Jafu) – Kotlin/Java micro-framework for creating lightweight Spring-powered appli
cations with functional APIs instead of annotations
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
15. 스프링 클라우드(Spring cloud):
Coordinate anything
Distributed systems simplified
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
16. Accessing Apps
• 분산 서비스들 요청
• Service Registry and Discovery
• Consul
• Eureka
• Etcd
• Service Discovery with Kubernetes
• Circuit Breaker : Hystrix / Resilience4J
• Request retries
• Fallback logic
• Control loop
• API Gateways : Routing, Load-Balancing
• Service Mesh
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
17. Inter Service Communication
• 동기 통신
• REST
• gRPC
• GraphQL : 여러 마이크로서비스 요청을 한번에
• WebSocket
• Apache Thrift
• 메시지 포멧
• JSON
• XML : 스키마
• Protocol Buffer
• Avro
1:1 1:N
동기
요청/응답
(Request / Response)
비동기
알림
(Notification)
퍼블리시/구독
(Publish / Subscribe)
요청/비동기 응답
(Request / Async response)
퍼블리시/비동기 구독
(Publish / Async response)
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
18. Cloud-Native Data : Decentralized Data
• Monolithic Application and 공유 데이터베이스 à Decentralized Data with Microservices
• 마이크로서비스별 데이터베이스 (Polyglot Persistence) à Data Island
• Sharing Data Between Microservices
• 공유 테이블의 제거
• 데이터 공유
• 데이터 구성 (Composition)
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
19. Cloud-Native Data : Decentralized Data
• 캐싱 – 모든 마이크로서비스는 캐시가 필요하다
• Redis
• Pivotal Gemfire (Pivotal Cloud Cache)
• EVCache
[ Look-Aside Cache ]
1000s of transact
ions per second
100s of transacti
ons per second
[ In-line cache (Front-ending a DB) ] [ Client-Side Subscription ]
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
20. Cloud-Native Data : Event-driven
• 느슨한 결합으로 분산시스템(마이크로서비스) 간에 상호 의존성을 배제할 수 있음
• 서비스 정보를 몰라도 메세지 브로커간 메세지 교환이 가능
• Eventual Consistency
[ Events for Notification ]
Send Notification
[ Events for data duplication ]
• 간단한 구조
• 외부 서비스 요청 à 종속성 증대
• 외부 서비스 요청 감소 à 종속성 감소
• 로컬 복사본 à 서비스 자유도 증가
• 로컬 데이터셋을 유지/복사 하기 위한 복잡도 증가
[ Data Capture를 이용한 데이터 복제]
CDC
CDC
CDC
Event Handlers Event Handlers
https://www.confluent.io/
Distributed, replicated event log
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
21. Cloud-Native Data : Kafka Stream
• 예) Kafka-Stream + Cache + Materialized Views
https://www.infoq.com/articles/microservices-startup/
REST API
Materialized View as State Store
Table for enrichment
Stream
Stream-Table-Join
Kafka Streams API
- join
- filter
- group by
- aggregate
KStream
{key1, value1}, {key2, value2}, {key1, value3}
KTable
key1, value3
key2, value2
Microservices
REST API
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
22. Cloud-Native Data : Transaction
• 마이크로서비스에서 트랜잭션 처리 – 보상트랜잭션 (Compensating operations)
• Two-Phase Commit (2PC)
• Publishing Events Using Local Transactions : Saga
• Database Log Mining (CDC : Change Data Capture)
• Event Sourcing
• TCC (Try-confirm/cancel)
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
23. Deploying and Running Microservices
• VM vs 컨테이너
• 도커 (Docker)
• Container Orchestration
• 쿠베르네티스 (Kubernetes)
• 클라우드 파운드리 (Cloud Foundry)
• 지속적 통합과 배포 (Continuous Integration and Delivery/Deployment)
• 서비스 메시 (Service Mesh: Istio (Envoy) or Linkerd)
• Resiliency for Inter-Service-Communications
• Service Discovery
• Routing
• Observability
• Security
• Deployment
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
24. Observability
• Troubleshooting : Finding the needle in the haystack
• Application logging
• EFK
• Datadog
• Application Metric
• Prometheus
• InfluxDB
• Distributed tracing
• Spring Cloud Sleuth / Zipkin
• Jaeger
• Open Tracing using Zipkin or Jaeger
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
25. Securing Microservices
• Securing Service-to-Service Communication
• JSON Web Token(JWT)
• Transport Layer Security(TLS) Mutual Authentication
• The Edge Security
• OAuth 2.0
• Controlling Access to a Microservices
• Scope-Based Access Control (SBAC)
• Role-Based Access Control (RBAC)
• Access Token
Developing Services
Access Apps
Cloud-Native Data
Running Microservices
Security
26. Cloud-Native는 피보탈과 함께..
TECHNOLOGY
CULTURE Build with
empathy
PROCESS
Continuously
improve
TOOLS
Focus on developer
productivity
PLATFORM
Run any app, on every
cloud, using one platform
MODERN
SOFTWARE
PROCESS