Java Performance Tuning
Java(TM) - see bottom of page
Our valued sponsors who help make this site possible
JProfiler: Get rid of your performance problems and memory leaks!
Training online: Concurrency, Threading, GC, Advanced Java and more ...
Tips January 2023
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 266 contents
https://www.youtube.com/watch?v=hLRFSsjt1a0
The State of OpenTelemetry for Java Developers (Page last updated October 2022, Added 2023-01-29, Author Philipp Krenn, Publisher Devoxx). Tips:
- Observability into distributed services is fundamentally different from 3-tier observability. The request flow straddles multiple systems and tailing multiple logs and tracking metrics across systems has no simple solution.
- Structured logs are necessary for searchability, which is fundamental for observability.
- Metrics give you a numeric value at a point in time and are easily aggregated. They are great for telling you something has happened, but not always what, and not at all why. Logs tell you what, and let you determine why. Traces tell you where.
- Agents plug in to the JVM and hook in to frameworks to identify and record requests.
- Traces work by generating a unique ID at request entry point, and then propagating that trace ID across the request flow (usually with a HTTP header or a message header). OpenTelemetry specifies a standardized header.
- OTLP, the OpenTelemetry protocol, is an implementation of the communications from the OpenTelemetry agent or SDK to a collector. The collector then needs to forward or store the data and something else needs to provide display and analysis of that data.
- The agent can automatically extract information from common frameworks, but rare or custom frameworks will often need code using the OpenTelemetry API added. You can also use the API to enrich the automated extraction traces with custom information.
https://www.youtube.com/watch?v=Fglxqjcq4h0
Profiling Tools for Java (Page last updated October 2022, Added 2023-01-29, Author Johannes Bechberger, Publisher Karlsruhe JUG). Tips:
- Guessing were the bottleneck is, is not as efficient as simply profiling to find it.
- Types of profiling include: method profiling, allocation profiling, lock profiling, GC profiling, DB Query profiling.
- Profilers include: async-profiler (alone or with jfrsync), JFR, VisualVM (but this last is affected by safepoint bias).
- There are 2 main types of profilers: instrumenting profilers which change the bytecode to add in timing code (accurate but slows execution and can distort the optimizations in the application); and sampling profilers which get the stack trace at regular intervals (fast but approximate).
- Safepoint bias is where profilers only report data at safepoints in the JVM (where all the application threads are paused) which means you get inaccurate data.
- There are 3 types of JVM sampling profilers: GetCallTrace based (eg VisualVM, these are affected by safepoint bias); AsyncGetCallTrace based (eg async-profiler); JFR based (eg JMC).
https://www.infoq.com/presentations/java-shared-memory-files/
Using Shared Memory-Mapped Files in Java (Page last updated November 2022, Added 2023-01-29, Author Peter Lawrey, Publisher QCon). Tips:
- Shared memory is the fastest way to transfer data between processes on the same host, allowing latencies - including serialization - of less than a microsecond. Typically the memory is on chip on the L2 cache when it's being transferred between active processes.
- A memory-mapped file is persisted shared memory which can be very large and is managed by the OS - no broker calls or system calls needed.
- FileChannel.map with MapMode.READ_WRITE gives you a MappedByteBuffer - but it's not thread safe. Also Chronicle OpenHFT MappedBytes.mappedBytes() handles a lot of the issues to get optimal efficiency - thread safety, variable file sizes, complex operations, sparse files.
- Chronicle OpenHFT provides extremely fast (faster than unique IDs) distributed unique timestamps using shared memory and host encoding.
- Binary formats with text readable conversions produces very efficient runtimes with acceptable debugging.
Jack Shirazi
Back to newsletter 266 contents
Last Updated: 2024-09-29
Copyright © 2000-2024 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/news/newtips266.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us