docker in the trial jfr

jrf is a good take up system resources, and powerful analysis tools jvm, the following is a docker trial (using openjdk11)
for jfr enabled, use jcmd

Preparing the Environment

  • docker-compose documents
 
version: "3"
services: 
  openjdk:
    build: 
      context: ./openjdk
      dockerfile: Dockerfile
    volumes: 
    - "./jfr:/jfr"
    ports: 
    - "8082:8080"
FROM openjdk:11-stretch
LABEL AUTHOR="dalongrong"
LABEL EMAIL="[email protected]"
WORKDIR /
COPY webapi-0.0.1-SNAPSHOT.jar /webapi-0.0.1-SNAPSHOT.jar
COPY docker-entrypiont.sh /docker-entrypiont.sh
RUN chmod +x /docker-entrypiont.sh
EXPOSE 8080 9999 30384
ENTRYPOINT [ "/docker-entrypiont.sh" ]
  • docker-entrypiont.sh
#!/bin/sh
java -XX:+FlightRecorder -jar /webapi-0.0.1-SNAPSHOT.jar

&& test run

  • run
docker-compose build openjdk
  • start up
docker-compose up -d openjdk
  • Enable jfr
docker-compose exec openjdk sh
jps ( the search process)
jcmd <pid> JFR.start name=demo filename=/jfr/appdemo.jfr
  • A simple pressure test
ab -c 10 -n 100000 http://localhost:8082/actuator/env
  • dump data
jcmd <pid> JFR.dump name=demo
jcmd <pid> JFR.stop name=demo

Explanation

Currently the community has also been provided, plug-ins and integration processes prometheus flame figure, jfr also supports programming capability, is a more powerful performance analysis tool jvm

Reference material

https://adoptopenjdk.net/jmc.html
https://www.ibm.com/developerworks/cn/java/j-lo-performance-analysissy-tools3/index.html
https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm#JFRUH170

Guess you like

Origin www.cnblogs.com/rongfengliang/p/12124132.html