[dev nexus 2024] a glance at the java performance toolbox

Speaker: Ana Maria Mihalceanu

@ammbra1508

For more, see the 2024 DevNexus Blog Table of Contents


What is performance

  • From user POV, how much work can do in a reasonable amount of time
  • From business, what is cost in computational resources needed to provide that user experience

Cloud

  • Practically unlmited resources
  • Reasonable cost

Container images

  • Tools to build container images – docker, jib, kaniko, buidah, etc
  • All started with a Dockerfile
  • Other tools arrived later to make easier

JLink

  • JRE stopped being included in Java 11
  • Can use jlink to include custom JRE with just modules need.
  • Can also omit man pages and header files.
  • Compress zip-9 offers the best compression.

Fine Tuning JVM Flags

  • Ergonomics docs – process for JVM/GC to tune performance measures
  • Tune min/max heap size with -Xms and -Xmx
  • Consider Java heap ratio

jcmd

  • Tracks native memory
  • Want available in container
  • Add jdk.jcmd module to application

Other commands/tools

  • Use jinfo to see what flags used in app
  • Helps when don’t know all flag names
  • Look for amount of memory reserved and amount used
  • Look for big values
  • JConsole – can see graph of memory use
  • jstat – garbage collection statistics
  • jmap – histogram of heap summary
  • Profiling with Java Flight Recorder – use when looking for something, not all the time. Need jdk.jfr module. Can specify how long to record.
  • Prometheus server – monitors/alerts on events
  • JFR Streaming – sends metrics to monitoring service

Sample app for testing at https://github.com/ammbra/performance-glance

My take

Good information and good demo. It was nice seeing the commands actually get used. Clear how to apply.

Leave a Reply

Your email address will not be published. Required fields are marked *