JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage...

36
JVM Web Application Metrics & Monitoring FOLIO @krrrr38 2

Transcript of JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage...

Page 1: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

JVM Web Application

Metrics & Monitoring FOLIO

@krrrr38

2

Page 2: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

3

Page 3: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

1.

2.

3. JVM Web Application

4

Page 4: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

5

Page 5: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

Metrics

6

Page 6: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

Metrics

JVM

http

JMX

jcmd, jstat, ...

7

Page 7: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

Metrics

server/process

pull /push

8

Page 8: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

pull /pushpush

server -(process)-> metrics storage gateway

e.g. mackerel agent

pull

server <- metrics

e.g. prometheus

9

Page 9: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

Example 1mackerel-agent (mackerel-jvm-plugin)

mackerel

https://mackerel.io/

process

10

Page 10: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

jvm app (jmx, perf,...)

jstat, jcmd

mackerel-agent

mackerel

mackerel 11

Page 11: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

Example 2prometheus, grafana

12

Page 12: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

jvm app: /metrics prom metrics

prometheus

grafana

prometheus

13

Page 13: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

Example 3telegraf

metrics interface gateway

telegraf

https://github.com/in�uxdata/telegraf

14

Page 14: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

15

Page 15: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

key value JMX

dropwizard metrics

16

Page 16: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

key+labels value

17

Page 17: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

key+labels value prometheus

kamon

micrometer

http://micrometer.io/

18

Page 18: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

response_time_GET_foo = 123msresponse_time_GET_bar = 250msresponse_time_POST_bar = 210msresponse_time_POST_foo_bar = 512ms

19

Page 19: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

average/max/95%tile

response_time_GET_foo_average = 123msresponse_time_GET_foo_max = 123msresponse_time_GET_foo_95% = 123msresponse_time_GET_bar_average = 250msresponse_time_GET_bar_max = 250msresponse_time_GET_bar_95% = 250msresponse_time_POST_bar_average = 210msresponse_time_POST_bar_max = 210msresponse_time_POST_bar_95% = 210msresponse_time_POST_foo_bar_average = 512msresponse_time_POST_foo_bar_max = 512msresponse_time_POST_foo_bar_95% = 512ms

95%tile / ...?

20

Page 20: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

SELECT * FROM metrics WHERE key IN (response_time_GET_foo_95%,response_time_GET_bar_95%,response_time_POST_bar_95%,response_time_POST_foo_bar_95%)

index

SELECT * FROM metrics WHERE key LIKE 'response_time_%_95\%'

21

Page 21: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

response_time{"method"=GET, path=foo, percent=50} = 123msresponse_time{"method"=GET, path=foo, percent=95} = 123msresponse_time{"method"=GET, path=foo, percent=100} = 123ms

template

percent

method=POST

22

Page 22: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

23

Page 23: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

24

Page 24: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

JVM Web ApplicationMetrics

25

Page 25: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

heap usage

gc lifecycle

thread pool

connection pool

cpu

request count / response time

queue

...26

Page 26: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

heap usage / gc lifecyclememory leak

Xmx

gc

( )

in-memory cache

512M~2G

FullGC STW

gc lifecycle

27

Page 27: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

thread / connection poolblocking thread

pool active

e.g. servlet not nio api

jedis/jdbc/... thread pool in application

blocking

thread pool

thread pool

implicit global

default ForkjoinPool

28

Page 28: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

server cpu / network / etcapplication

cpu

network

29

Page 29: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

request count / responsetime / queue / ...

30

Page 30: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

31

Page 31: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

micrometer

32

Page 32: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

micrometerJava

key+labels value

plugin

JVM System metrics, GC, logback, tomcat,

jetty, hikaricp

jmx, prom, in�ux, datadog agent,...

33

Page 33: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

jmx, java agent, -XX:+FlightRecorder , ...

34

Page 34: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

agentjava -jar

e.g. NewRelic

35

Page 35: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

36

Page 36: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server

framegraph:

http://www.brendangregg.com/blog/2015-11-

06/java-mixed-mode-�ame-graphs.html

https://github.com/jvm-pro�ling-tools/perf-

map-agent

https://glowroot.org/

37