Top Banner
JVM Web Application Metrics & Monitoring FOLIO @krrrr38 2
36

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

Jul 07, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: JVM Web Application Metrics & Monitoring · pull /push push server -(process)-> metrics storage gateway e.g. mackerel agent pull server <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

3

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

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 <- metrics e.g. prometheus 9

5

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

Metrics

6

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

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 e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

15

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

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

23

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

24

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

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

31

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

micrometer

32

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

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

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 <- metrics e.g. prometheus 9

36

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

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