Upload
domaindriven-domaindriven
View
403
Download
15
Embed Size (px)
Citation preview
SCOUTER commiter
Gunhee Lee
Monitoring application performance
With scouter
이건희 – 그분은 아닙니다.
LG CNS software architect
LG CNS APM 개발자
Scouter commiter
KOSSA 오픈프론티어
제 10회 공개소프트웨어 대회 멘토
발표자 소개
그래서 구글서 검색 안됨
UXM NMS
EMS
SMS
Profiler
APM Database Mon.
Intranet
& Security
Gateway
& Firewall Browser Network
Web Server Web App.
External Org.
SSO
DB
System performance monitoring
Why APM?
왜 어플리케이션 모니터링이
필요한가?
System performance monitoring
대부분의 문제 원인은 Application !
System performance monitoring
문제의 식별 - 어플리케이션 모니터링
문제의 해결 - 어플리케이션 튜닝
결국 문제의 원인을 찾는 것이 중요
System performance monitoring
아는 만큼 보이고
보이는 만큼 개선할 수 있다.
- By 유명인 -
System performance monitoring
몰라도 보이고 ~
보이는 만큼 개선할 수 있다.
- By Scouter -
(SCOUTER를 조금만 알면)
System performance monitoring
Scouter Basics
APM
- Application performance
management
SCOUTER?
아키텍처는? Agent, Collector, Client
WAS
Java Agent
WEB
application
Host Agent
Scouter
Collector
Server
성능 정보 전송
성증정보 수집
Scouter
Client 성능정보
요청
SCOUTER?
SCOUTER?
Object
Alert
Active Service
CPU
Visitor
Throughput
Elapsed
Heap
XLOG
Active service Top
Today call count
Active speed
(Java) Application Problems
Unhandled Exception
Slow query / Slow external call
Thread hang
Inefficient logic
Object Leak / Unclosed resource
Out of memory
Slow transaction
1. Slow transaction
Logic
Logic
Very long time Database Query
Request
Response
1. Slow transaction
Active Service
1. Slow transaction
Active Service
1. Slow transaction
XLOG
1. Slow transaction
Profile
2. Thread hang
Requests Threads
Locked
Very very very very slow
Blocked
Very very slow
2. Thread hang
Object request > Thread List
Object request > Thread Dump
2. Thread hang
Thread List
2. Thread hang
Thread Dump
3. Out of memory
정말 싫다…
Memory leak 으로 발생
대량건 조회
기타… (버퍼링 없는 Big file 처리…)
3. Out of memory
Heap used
Object req. > Heap Histogram
Object req. > Heap dump
Too many record exception
--> 10,000 건 초과시
4. Resource leak
Get Connection
Connection Pool
Release connection
execute
execute
excecute
Missing !
4. Resource leak
Connection leak
Statement leak
ResulteSet leak Hang !
OOM !
4. Resource leak
SCOUTER Options
5. Inefficient Logic / Logic outside of app.
light but too many executions
evil library / framework
checkLogging() – 1 ms
10s checkLogging() – 1 ms
checkLogging() – 1 ms
Biz()
Biz()
…
10,000 times call
5. Inefficient Logic / Logic outside of app.
SFA ( Stack frequency analyzer )
Request
Processing
Thread Dump
5sec 5sec 5sec
• Top stack frequency
• Top-down analysis
서비스 아키텍처
- SOA
- MSA
6. SCOUTER for service architecture
6. SCOUTER for service architecture
관계의 복잡성으로 인한 문제.
6. SCOUTER for service architecture
관계의 복잡성으로 인한 문제.
대표적으로 Cascading failure
6. SCOUTER for service architecture
Cascading failure
Ref. https://github.com/Netflix/Hystrix/wiki
6. SCOUTER for service architecture
Cascading failure
Ref. https://github.com/Netflix/Hystrix/wiki
6. SCOUTER for service architecture
Cascading failure
Ref. https://github.com/Netflix/Hystrix/wiki
6. SCOUTER for service architecture
내꺼 인듯
내꺼 아닌
내꺼 같은 장애…
6. SCOUTER for service architecture
필요한 것은?
6. SCOUTER for service architecture
필요한 것은
개발에선 Anti-fragile patterns
모니터링에선 Cross Service Tracing
6. SCOUTER for service architecture
Cross service tracing
6. SCOUTER for service architecture
Demo #1
Q&A #1
Scouter In Practice
Pulse is the platform for building
lightweight agent program
for many types of data
you want to enrich with Scouter.
Whether you’re interested in
system performance metrics.
Scouter PULSE
Http 프로토콜을 이용한 성능 카운터 수집 I/F
- 숫자로 이루어진 데이터의 수집
Scouter PULSE
- Pros
Scouter PULSE
- Cons
Simple한 Agent를 아주 쉽게 제작 가능
Http 사용가능한 Any 언어로~
전용 Protocol에 비해 부하 증가
( TCP/Binary <-> HTTP/JSON )
- Pros
Scouter PULSE
- Cons
Simple한 Agent를 아주 쉽게 제작 가능
Http 사용가능한 Any 언어로~
전용 Protocol에 비해 부하 증가
( TCP/Binary <-> HTTP/JSON )
- https://github.com/scouter-project/scouter-pulse
Scouter PULSE
- 활용 예시 #1
Scouter PULSE
Redis / Apache HTTPD 등의
perf stat 정보를 scouter로 전송하여 모니터링
- 활용 예시 #2
주요 Business 데이터를 Scouter로 전송하여 모니터링
# 데모로 봅시다 ~
Scouter PULSE
- 상품별 분당 주문량
- 상품별 일 누적 판매량
- 생방송 실시간 주문량
- 생방송 주문 실패
…
Simple Scripting Plugin
Built-in plugin
Scouter Plugin ******
1) Agent Plugin
2) Collector server Plugin
Scripting Plugin
Http Service plugin
Http Call Plugin
Capture(parameter, return value)
…
Agent Plugin을 통한 사용자ID 프로파일
Java Agent – Http service plugin
1. 세션에서 user id 획득 String userId =
$req.getSessionAttribute(“userId”);
Java Agent – Http service plugin
2. XLog 항목에 id로 추가
$ctx.login(userId);
Agent Plugin을 통한 사용자ID 프로파일
Java Agent – Http service plugin
3. Profile에 사용자 정의 문장 기입
$ctx.profile(“Login ID = ” + userId);
Agent Plugin을 통한 사용자ID 프로파일
$ctx.login(userId);
$ctx.profile(“### It’s user defined …” + userId);
Agent Plugin을 통한 사용자ID 프로파일
데모!
Agent Plugin을 통한 Parameter debugging
Agent Plugin을 통한 Parameter debugging
A서비스가 가끔 에러가 발생하거나 느려지는데…
파라미터 확인만 되면 해결할 수 있을 듯…
근데 로깅 불가… 재기동 불가…
Agent Plugin을 통한 Parameter debugging
Capture plugin
+ hook_args_patterns
+ redefine class
Agent Plugin을 통한 Parameter debugging
데모로 보자!
사용자 요청을 받는 Front Service에서
1) 테넌트ID를 추출하여 프로파일 하고
Backend 2) Service로 호출시 테넌트ID를 전달하고 싶다.
Backend Service들 에서도
3) 전달된 테넌트 ID를 프로파일 하고 지속적으로 전달하고 싶다.
그리고 특정 프로파일 정보는 4) 자체 집계 시스템으로 모으고 싶다.
Plugin 활용사례
Plugin
Service (Back)
Scouter Agent
Service (Back)
Scouter Agent
Service (Front)
Scouter Agent
Service (Back)
Scouter Agent
<Http Service Plugin>
1) Req.에서 테넌트ID 식별
-- 프로파일링
<Http Call Plugin>
2) Http Call 헤더에
테넌트 ID 추가
<Http Service Plugin>
3) Http 헤더에서
테넌트 ID 식별
-- 프로파일에 반영
Scouter Collector 성능정보수집
Apache Kafka
Legacy 분석계
<Collector Plugin>
4) 테넌트 ID를 포함한
프로파일을 Kafka로 전달
S t O r m InfluxDB
RDB
Hbase
Legacy Dashboard
Plugin 활용사례
Scouter-Alert-Telegram
Built-in Plugin
Scouter-Influxdb
Scouter-Alert-Telegram
https://github.com/scouter-project/scouter-plugin-server-alert-telegram
Telegram Bot으로 Alert 전송
Scouter-Alert-Telegram
Influxdb-plugin
https://github.com/scouter-project/scouter-plugin-server-influxdb
성능 카운터를 Influxdb로 전송
Influxdb-plugin
Influxdb – 시계열 database
Grafana – 시계열 대시보드 작성
Influxdb-plugin
Scouter -> InfluxDB -> Grafana
연동해 보기 참고 url
https://goo.gl/fSd8Dd
Influxdb-plugin
Demo
http://demo.scouterapm.com:3000
Built-In Plugin 제작
1. scouter.plugin.server 패키지로 시작
2. Method annotation 명시
3. jar로 만든 후 ./lib 디렉토리에 넣는다.
* Dependency - scouter.common
- scouter.server
Built-In Plugin 제작
Built-In Plugin 제작
Guide 문서 https://github.com/scouter-
project/scouter/blob/master/scouter.document/main/Plugin-Guide.md
질문 있으신가요?
Application 모니터링
Application Tuning
Plugin
- debugging, 사용자정의 프로파일
- 다른 오픈소스와 결합, 확장
정리해 보자 !
그리고..
Plugin을 활용하여
Centralized logging / monitoring
물론 Application의 수정 없이…
SCOUTER의 확장
조만간 …
kafka-plugin
elasticsearch-Plugin
Redis-Agent
올해안에 가능하면 …
Nodejs agent
SCOUTER가 하고 싶은 것
오픈 소스 중심의 통합 모니터링 node.js(w/ express.js)
Apache HTTPD
Redis / memcached
NoSQL(Mongo DB…) Opensource RDB (Maria, Cubrid…)
Client side monitoring(script error, dom rendering)
…
쉬운것 부터…
다양한 형태의 Contribution을 기다립니다~
매뉴얼
Plugin
간단한 Agent
SCOUTER에 기여하기
Github https://github.com/scouter-project/scouter
Facebook 사용자 모임 https://www.facebook.com/groups/scouterapm