Java: more metrics, less garbage collection

|

,

Asaf Mesika has a happy story about improving the OpenTelemetry SDK in Java.

OpenTelemetry values immutable data, because it is thread-safe and easier to get right. Using immutable data, you can’t re-use memory; you free it and then allocate new stuff for the next thing.

In Java, memory allocation is fast… until you start to run out, and then it’s time for garbage collection. Depending on which JVM you’re running and with which options, garbage collection can pause the entire process for seconds. That’s a major slowdown.

Metrics happen over and over, the same amount of them. Asaf’s strategy of carefully re-using memory in this specific case helps OpenTelemetry avoid impacting application performance. Great work getting this change in!

Read the story: https://medium.com/@asafmesika/optimizing-java-observability-opentelemetrys-new-memory-mode-reduces-memory-allocations-by-99-98-e0062eccdc3f

Latest Articles

Subscribe to
our newsletter

OpenTelemetry in Practice