Skip to content
Tagged articles

Attach API

3 articles · Page 1 of 1
SpringMeng
SpringMeng
Oct 22, 2026 · Backend Development

Java Agent Internals: Building Non-Invasive Profiling with Instrumentation & ASM

This article demonstrates how to build a Java Agent using the Instrumentation API and ASM for bytecode manipulation, covering premain/agentmain entry points, dynamic class redefinition via Attach API, and explores Arthas trace command's implementation using the bytekit framework for non-invasive method profiling.

ASMArthasAttach API
0 likes · 21 min read
Java Agent Internals: Building Non-Invasive Profiling with Instrumentation & ASM
Architect's Guide
Architect's Guide
Sep 15, 2025 · Backend Development

How to Use Java Agents and Instrumentation for Non‑Intrusive Performance Monitoring

This article explains why inserting manual timing code is invasive, introduces the java.lang.instrument API, shows how to write a tiny Java Agent with premain and agentmain methods, demonstrates dynamic class redefinition via the Attach API, and explores how tools like Arthas and Bytekit leverage these mechanisms for runtime tracing and bytecode enhancement.

ArthasAttach APIJava
0 likes · 19 min read
How to Use Java Agents and Instrumentation for Non‑Intrusive Performance Monitoring