Integration / Apache Pulsar Interview questions
Explain the internal working of AppDynamics' byte-code instrumentation?
When the Java Agent starts, it registers a Java agent premain hook (the standard JVM instrumentation API) that gets control before the application's own classes finish loading, giving it the chance to modify bytecode on the fly rather than after the fact.
For each class the JVM is about to define, the agent checks it against a set of built-in and configured interception rules — things like "this class implements HttpServlet" or "this method calls a JDBC driver." Matching methods get wrapped with additional bytecode that records entry time, exit time, and exceptions, then delegates back to the original logic unchanged, so application behavior is preserved while timing and correlation data streams out to the agent's internal metrics pipeline.
This weaving happens once per class per JVM lifetime (the JVM caches the modified bytecode), which is why the ongoing runtime overhead of instrumentation is typically small — the expensive analysis work happens at class-load time, not on every single method call afterward.
More Related questions...
