마이크로서비스로 시스템을 구성하면 서비스간에 연관관계가 줄어들면서 서비스 릴리즈 속도가 높아지고 유연하게 대처할 수 있지만, 관리포인트가 늘어나게 되어 운영상에 많은 어려움을 마주치게 됩니다. 배포 될 때마다 생성되고 소멸되는 마이크로서비스를 다른 마이크로서비스가 쉽게 참조하게 하고 마이크로서비스들의 설정 정보를 일관되게 관리하는 일은 쉬운일이 아닙니다. 이러한 문제를 해결하기 위해 Spring Cloud 프로젝트와 같은 도구를 비롯하여 Pivotal Cloud Foundry와 같은 클라우드 플랫폼등이 있습니다. 이번 밋업에서는 마이크로서비스를 운영할 때의 어려운점과 도움을 주는 다양한 도구들에 대해 알아보도록 하겠습니다.
3. September 24–27, 2018
Washington DC
Gaylord, National Harbor
Discount Code
S1P200_MKim
Hear more of
cases & tactics
like these, plus
nerd stuff.
Register Today
& Save!
6. “Pivotal is currently contributing as much software
to open source projects as IBM.”
Source: https://redmonk.com/jgovernor/2017/10/25/some-thoughts-on-the-top-contributors-to-github-2017/
전 세계의 2,500명이 넘는 Pivotal의 개발자들은 다양한 오픈소스 프로젝트에 깊게 기여하고
있음
7. Process &
Culture
Build for
change
DevOps Tools
Continuously
Improve
Platform
Any App, Every Cloud,
One Platform
Pivotal Cloud
Foundry
Tracker / Spring / Concourse
Pivotal Labs
Data / AI
Apps
Open Source Based
Data
Pivotal Big
Data Suites
Customer
Insight
Dojo
개발자 중심의 실리콘 밸리 기업인 Pivotal은 디지털 변혁을 위한 1) 문화/프로세스, 2) 기술 플랫
폼, 3) DevOps 툴 및 4) 데이터 분석에 걸쳐 다양한 Offering을 제공 하고 있음
Pivotal
Data Science
5조원 21 +2,500
시가총액 글로벌 오피스 개발자
1/3 이상의..
Pivotal Overview
Fortune 100 회사가 Pivotal과 함께 일하고 있습니다.
7 of the largest banks / payments
9 of the largest automakers
7 of the largest insurers
8 of the largest retailers
9 of the largest telcos
Pivotal Customers
8. Agenda
■ 이번 밋업에서 다루는 도구들
■ 마이크로서비스 기반서비스
■ 모니터링 및 통합로그수집
■ 장애 내성을 키워주는 도구
■ Q&A
10. 우리의 IT환경은 점점
• 마이크로 서비스팀이 점점 작아지고 많아짐
• API contract 개선이 더 잦아짐(Agile)
• 다른 시간대(Timezone)의 팀간의 협업이 요구됨
11. Cloud Native 시스템 운영을 위한 도구들은
■ 앱 자동배포
■ MSA를 위한 기반 서비스
■ On-demand backing service
■ 실시간 모니터링
■ 중앙집중형 통합로그
개발자의 속도
■ VM, 로드밸런서, IP관리 자동화
■ 플랫폼 설치 자동화
■ App, VM,AZ까지의 고가용성
■ 플랫폼/서비스 통합 모니터링
■ 중앙집중형 통합로그
■ Autoscaling
■ 플랫폼 무중단 업데이트
■ 신속한 보안패치
■ 컨테이너 보안
■ Credentials 관리및 rotate
운영자의 안정성
12. Cloud native 서비스를 도와주는 도구들.
Customer
Service
Loyalty
Service
Notifications
Service
Other…
Create Loyalty Bank
Send Email
Email
Service
Post
Service
Generate Mail
Other Actions
Backend for
Frontend
Backend for
Frontend
Backend for
Frontend
Backend for
Frontend
Service
Adaptor1
Adaptor2
Translator
Config Registry
CB
Dashboard
Compliance …..
Saboteur
Vizceral
Spring Boot Admin
Microservice Dashboard
14. MSA를 위한 기반 서비스
Web
Frontend
Customer
Service
Loyalty
Service
Notifications
Service
Other…
Create Loyalty Bank
Send Email
Email
Service
Post
Service
Generate Mail
Other Actions
Mobile
Wearables
Echo
3rd Party
Backend for
Frontend
Backend for
Frontend
Backend for
Frontend
Backend for
Frontend
ESB
Payments
Other
Service
Adaptor1
Adaptor2
Translator
LegacyCore Business uServicesAPI Gateway uServices Anti Corruption uServices
Config Registry
CB
Dashboard
Compliance ….. ……
Foundational uServices
15. Spring boot기반 앱의 모니터링과 관리를 위한 라이브러리
Spring Boot Actuator 1.x Spring Boot Actuator 2.x
• Spring MVC • Spring MVC
• Spring WebFlux
• Jersey
<dependency>!
<groupId>org.springframework.boot</groupId>!
<artifactId>spring-boot-starter-actuator</artifactId>!
</dependency>!
18. With PCFWithout PCF
Config Server Service
Registry
(Eureka)
Circuit Breaker
(Hystrix)
개발자가 배포 및 보안 관리 플랫폼이 배포 및 보안 관리
Config Server Service Registry
(Eureka)
Circuit Breaker
(Hystrix)
MSA기반 서비스의 사용예
29. 분산시스템을 위한 모니터링 도구 - Prometheus
• SoundCloud에서 개발하여 오픈소스화
• multi-dimensional data model 데이터가 host, service, endpoint, method단위로 조합이
되어서 multi-dimensional data model이 제공
• Operational simplicity 설설치가 쉬운 모니터링 정관리가 쉬워서 박사학위가 없어도 될 정도로
• Scalable and decentralized
• powerful query language 시각화와 의미있는 알림을 줄 수 있는 데이터모델, Query.
https://ordina-jworks.github.io/monitoring/2016/09/23/Monitoring-with-Prometheus.html
https://prometheus.io/docs/introduction/comparison/
30. 모니터링 도구 특징
Server polls Client pushes
Prometheus
Atlas, Datadog, Datadog StatsD,
Influx, SignalFx, Telegraf StatsD,
Wavefront, New Relic
Dimensional
Graphite, Ganglia, JMX, Etsy StatsD,
PCF Metrics 1.4
Hierarchical
36. Prometheus 자동 설치 및 Cloud Foundry 플랫폼 모니터링 자동화
https://github.com/myminseok/pcf-prometheus-pipeline
https://github.com/bosh-prometheus/prometheus-
boshrelease
Cloud Foundry상의 모든 메트릭을 시각화/알림
• VM메트릭 (node_exporter)
• Process Metric (Bosh_exporter)
• App metric (cf_exporter)
38. Prometheus best practices
• 대시보드 하나에 5개 미만 그래프유지
• 각 그래프에 5개 Plots(lines)이하 유지
• 유용하지 않은 데이터는 제거
• 용도별 대시보드 분리( 개발용, 운영용)
• 알림은 간단히, 엔드유져가 느끼는 현상 중심으로, 문제파악에 도움이 되는 요소를 링크로 포함.
• Pushgateway는 SPOF이므로 필요한 곳에 사용
• 네트워크 분리의 경우 같은망에 Prometheus서버 구성
https://prometheus.io/docs/practices/consoles/
39. 벤더 중립적인 애플리케이션 메트릭 수집
39
• JVM based Application code
• Dimensional Metrics
• Integrated into Spring
• Support for popular monitoring system (no vendor lock-in)
https://micrometer.io/
• Prometheus
• Netflix Atlas
• CloudWatch
• Datadog
• Graphite
• Ganglia
• JMX
• Influx/Telegraf
• New Relic
• StatsD
• SignalFx
• Wavefront
46. 서비스 장애 주입 - Trouble maker
https://keyholelabs.com/trouble-maker/
https://github.com/in-the-keyhole/khs-trouble-maker
https://github.com/in-the-keyhole/khs-spring-boot-troublemaker-starter
Netflix Chaos Monkey는 EC2 API에 제한
Cloud에 독립적
Service registry연동
스케줄링 기능
랜덤 장애발생
- KILL
- LOAD
- Memory
- Exception
47. 서비스 장애 주입 - Trouble maker
https://github.com/in-the-keyhole/khs-trouble-maker
https://github.com/in-the-keyhole/khs-spring-boot-troublemaker-starter
48. 네트워크 장애주입 - Saboteur
Saboteur: https://github.com/tomakehurst/saboteur
Vagrant wiremock saboteur https://github.com/chbatey/vagrant-wiremock-saboteur
네트워크 장애 주입 도구로서 장애 내성 및 안정성 테스트를 간단하게 하여줌
• Total network partition
• Remote service dead (not listening on the expected port)
• Delays
• Packet loss
• TCP connection timeout (as often happens when two systems are
separated by a stateful firewall)
• Support Linux only
49. 네트워크 장애주입 - Saboteur
Saboteur: https://github.com/tomakehurst/saboteur
Vagrant wiremock saboteur https://github.com/chbatey/vagrant-wiremock-saboteur
Vagrant 테스트 시뮬레이션 환경
Saboteur
Wiremock server
Iptables, tc
$ cd vagrant-wiremock-saboteur/vm
$ curl 192.168.2.2:8080/name
eth1
$ rpm -ivh https://github.com/tomakehurst/saboteur/releases/download/v0.7/saboteur-0.7-1.noarch.rpm
$ service saboteur-agent start
51. 애플리케이션이 컨테이너에 배포되고 관리되는 과정
코드 및 테스트 완료 후 해야하는 일
가용한 호스트 찾기
Docker image 설정
Docker 허브에 로그인
원하는 OS를 포함하는 Docker 이미지 받기
Docker 컨테이너 내부로 진입해서 OS 업데이트
필요한 런타임 수동 설치
Docker 이미지를 허브에 올리기
컨테이너를 호스트에 배포
환경 변수 설정
로드발란서 구성
SSL 생성
방화벽 구성
서비스 모니터링 도구 갱신
로그 수집기 구성
스케일링
52. 애플리케이션이 컨테이너에 배포되고 관리되는 전과정을 플랫폼에 위임하
고 개발자는 코드개발에 집중합니다.
cf push
~ 45 seconds
Speed &
Consistency
코드 및 테스트 완료 후 해야하는 일
가용한 호스트 찾기
Docker image 설정
Docker 허브에 로그인
원하는 OS를 포함하는 Docker 이미지 받기
Docker 컨테이너 내부로 진입해서 OS 업데이트
필요한 런타임 수동 설치
Docker 이미지를 허브에 올리기
컨테이너를 호스트에 배포
환경 변수 설정
로드발란서 구성
SSL 생성
방화벽 구성
서비스 모니터링 도구 갱신
로그 수집기 구성
스케일링
Platform의 빌드팩(Build-Pack)
• 앱을 구동하기 위해 필요한 Dependency(JVM, Tomcat,
Apache 등)를 미리 구축해 놓는 것이 아닌, 앱을 배포하는 시점
에 앱에서 필요한 정확한 Dependency(라이브러리, JVM, 미들
웨어 등)를 Build-pack에서 찾아 설치하여 사용하게 함
• 빌드팩 역시 개발/스테이징/운영 환경을 별도로 관리하며, 이를
통해 환경의 일치를 구성할 수 있음
• Self-Contained App형태로 운영 가능하도록 하여 즉시적으로
Deploy할 수 있는 형태
Platform의 Cloud Controller
• 플랫폼에서 컨테이너 생성, 환경변수 설정, 라우팅 설정, 방화벽
구성, 로그 수집등의 앱 구동을 위한 스텝 지원
• 이 후, 앱 운영(Operation)에 필요한 HA/Scaling 지원
57. 플랫폼 운영자를 위해 플랫폼의 현재상황/메트릭 추이를 한눈에 보여주는 대시보드를 제공하여 플랫폼 운영
의 통찰을 제공
§ End User Impact
- Http Request Throughput, Latency
- Router CPU
- 502 bad gateway
§ Developer Impact
- cf command line도구의 응답성능
- 어플리케이션 배포공간 잔여용량(메모리, 디스크)
- 총 container수
§ Platform Impact
- 플랫폼 컴포넌트 health 상태
- 플랫폼 구성요수의 리소스 사용량(메모리, 디스크)
58. 플랫폼 운영자를 위해 플랫폼의 현재상황/메트릭 추이를 한눈에 보여주는 대시보드를 제공하여 플랫폼 운영
의 통찰을 제공
§ End User Impact
- Http Request Throughput, Latency
- Router CPU
- 502 bad gateway
§ Developer Impact
- cf command line도구의 응답성능
- 어플리케이션 배포공간 잔여용량(메모리, 디스크)
- 총 container수
§ Platform Impact
- 플랫폼 컴포넌트 health 상태
- 플랫폼 구성요수의 리소스 사용량(메모리, 디스크)