# Towards Runtime-Aware Observability for Java Virtual Threads

DevFeed: [Towards Runtime-Aware Observability for Java Virtual Threads](<https://devfeed.tech/articles/towards-runtime-aware-observability-for-java-virtual-threads-131704.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.14999>)

Author: Wenjie Ding

Published: 2026-11-13T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [observability](<https://devfeed.tech/topics/observability.md>), [tracing](<https://devfeed.tech/topics/tracing.md>), [eBPF](<https://devfeed.tech/topics/ebpf.md>), [openjdk](<https://devfeed.tech/topics/openjdk.md>)

Tags: [cs-os](<https://devfeed.tech/tags/cs-os.md>), [cs-pf](<https://devfeed.tech/tags/cs-pf.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [java](<https://devfeed.tech/tags/java.md>), [observability](<https://devfeed.tech/tags/observability.md>), [runtime](<https://devfeed.tech/tags/runtime.md>), [virtual-threads](<https://devfeed.tech/tags/virtual-threads.md>)

## AI overview

Java virtual threads can break OS-level tracing that joins requests to kernel events by thread ID, because virtual threads move between carrier threads. The proposed design binds a 64-byte off-heap trace buffer at a stable address to each virtual thread and publishes it to eBPF through four USDT probes in patched OpenJDK. In tests, it attributed all 768 markers correctly; a naive two-probe design silently misattributed context. With no consumer attached, publication costs at most about 33 ns per transition, while buffer allocation costs about 0.37 μs per virtual thread--small on transition-heavy workloads but nearly doubling a creation-only microbenchmark. The compared JVMTI channel costs about 20% on transition-heavy workloads and 1.8 μs per virtual thread in the creation-only test. For readers that cache record addresses, the abstract finds only in-place updates guarded by the valid flag sound among the two OTEP 4947 strategies discussed.

## Source excerpt

arXiv:2611.14999v1 Announce Type: cross Abstract: OS-level observability tools join application requests to kernel events through the OS thread ID, assuming that a unit of work occupies one OS thread until it completes. Java virtual threads break this assumption: many virtual threads are multiplexed onto a few carrier threads, so a stable thread ID hides a changing unit of work, and the join fails silently. Existing virtual-thread-aware channels republish context or identity on every mount and unmount, and the JVMTI-based one pays this cost for the lifetime of the JVM, whether or not an observer is attached. We bind a 64-byte off-heap trace buffer to each virtual thread, at a fixed address for its lifetime, and publish the address to eBPF consumers through four USDT probes in a patched OpenJDK; a re-implemented JVMTI channel over the same buffer serves as a controlled comparison. The four-probe design attributed all 768 test markers correctly on both the content and the identity plane, while the naive two-probe design silently misattributes trace context. With no consumer attached, publication costs at most about 33 ns per transition; the remaining dormant cost is buffer allocation, about 0.37 microseconds per virtual thread, which is negligible on transition-heavy workloads but nearly doubles the cost of a creation-only microbenchmark. The JVMTI channel costs about 20% on transition-heavy workloads and about 1.8 microseconds per virtual thread on the creation-only one. We also show that, of the two update strategies OTEP 4947 permits, only in-place rewriting guarded by the record's valid flag is sound for readers that cache the record's address, as lifecycle-event readers do.