Repository: pinpoint-apm/pinpoint
Issue: Change default instrumentation engine to ASM
Labels: enhancement

Starting from 1.6.0, agent's bytecode instrumentation will use ASM instead of Javassist.

Issue comments:
merged via #2216 

Btw. why did you decide on this change?

Hi @otisg 
It was mostly due to performance/feature reasons, ASM seemed to offer better performance and faster startup time, and more features for the agent to expand upon.


Pull request review comments:

Patch that resolved the issue:
diff --git a/agent/src/main/resources-local/pinpoint.config b/agent/src/main/resources-local/pinpoint.config
index b98f423f1317..960913a0a3c6 100644
--- a/agent/src/main/resources-local/pinpoint.config
+++ b/agent/src/main/resources-local/pinpoint.config
@@ -77,7 +77,7 @@ profiler.callstack.max.depth=64
 profiler.interceptor.exception.propagate=false
 
 # Allow bytecode framework (JAVASSIST or ASM)
-profiler.instrument.engine=JAVASSIST
+profiler.instrument.engine=ASM
 
 # bytecode dump option
 # java bytecode debug option
diff --git a/agent/src/main/resources-release/pinpoint.config b/agent/src/main/resources-release/pinpoint.config
index 0b74038e98d5..7aff500ebbae 100644
--- a/agent/src/main/resources-release/pinpoint.config
+++ b/agent/src/main/resources-release/pinpoint.config
@@ -73,7 +73,7 @@ profiler.callstack.max.depth=64
 profiler.interceptor.exception.propagate=false
 
 # Allow bytecode framework (JAVASSIST or ASM)
-profiler.instrument.engine=JAVASSIST
+profiler.instrument.engine=ASM
 
 # bytecode dump option
 # java bytecode debug option
diff --git a/agent/src/main/resources/pinpoint-real-env-lowoverhead-sample.config b/agent/src/main/resources/pinpoint-real-env-lowoverhead-sample.config
index f7189b224f9b..d0e8f912c8a5 100644
--- a/agent/src/main/resources/pinpoint-real-env-lowoverhead-sample.config
+++ b/agent/src/main/resources/pinpoint-real-env-lowoverhead-sample.config
@@ -65,7 +65,7 @@ profiler.callstack.max.depth=64
 profiler.interceptor.exception.propagate=false
 
 # Allow bytecode framework (JAVASSIST or ASM)
-profiler.instrument.engine=JAVASSIST
+profiler.instrument.engine=ASM
 
 # java bytecode dump option
 bytecode.dump.enable=false
diff --git a/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java b/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java
index e2c7bd61caa4..c36125f3c338 100644
--- a/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java
+++ b/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java
@@ -43,6 +43,7 @@ public class DefaultProfilerConfig implements ProfilerConfig {
     private final Properties properties;
     private final PropertyPlaceholderHelper propertyPlaceholderHelper = new PropertyPlaceholderHelper("${", "}");
 
+    @Deprecated
     public static final String INSTRUMENT_ENGINE_JAVASSIST = "JAVASSIST";
     public static final String INSTRUMENT_ENGINE_ASM = "ASM";
 
@@ -370,7 +371,7 @@ void readPropertyValues() {
         final ValueResolver placeHolderResolver = new PlaceHolderResolver();
 
         this.profileEnable = readBoolean("profiler.enable", true);
-        this.profileInstrumentEngine = readString("profiler.instrument.engine", INSTRUMENT_ENGINE_JAVASSIST);
+        this.profileInstrumentEngine = readString("profiler.instrument.engine", INSTRUMENT_ENGINE_ASM);
 
         this.interceptorRegistrySize = readInt("profiler.interceptorregistry.size", 1024*8);
 
diff --git a/quickstart/agent/src/main/resources/pinpoint.config b/quickstart/agent/src/main/resources/pinpoint.config
index 41268735acb4..9723796f9d57 100644
--- a/quickstart/agent/src/main/resources/pinpoint.config
+++ b/quickstart/agent/src/main/resources/pinpoint.config
@@ -55,6 +55,25 @@ profiler.tcpdatasender.command.accept.enable=true
 # Trace Agent active thread info
 profiler.pinpoint.activethread=true
 
+## Call Stack
+# Set max depth, if -1 is unlimited and min is 2.
+profiler.callstack.max.depth=64
+
+# weather or not to propagate exceptions occurred at interceptor
+profiler.interceptor.exception.propagate=false
+
+# Allow bytecode framework (JAVASSIST or ASM)
+profiler.instrument.engine=ASM
+
+# bytecode dump option
+# java bytecode debug option
+bytecode.dump.enable=false
+#bytecode.dump.classlist=com.naver.user.UserService,com.pinpoint.debug.TestClass
+bytecode.dump.classlist=
+bytecode.dump.bytecode=false
+bytecode.dump.verify=false
+bytecode.dump.asm=false
+
 ###########################################################
 # application type                                        #
 ###########################################################
diff --git a/quickstart/conf/pinpoint.config b/quickstart/conf/pinpoint.config
index e1a164eea5d5..abccb3d27a1c 100644
--- a/quickstart/conf/pinpoint.config
+++ b/quickstart/conf/pinpoint.config
@@ -55,6 +55,25 @@ profiler.tcpdatasender.command.accept.enable=true
 # Trace Agent active thread info
 profiler.pinpoint.activethread=true
 
+## Call Stack
+# Set max depth, if -1 is unlimited and min is 2.
+profiler.callstack.max.depth=64
+
+# weather or not to propagate exceptions occurred at interceptor
+profiler.interceptor.exception.propagate=false
+
+# Allow bytecode framework (JAVASSIST or ASM)
+profiler.instrument.engine=ASM
+
+# bytecode dump option
+# java bytecode debug option
+bytecode.dump.enable=false
+#bytecode.dump.classlist=com.naver.user.UserService,com.pinpoint.debug.TestClass
+bytecode.dump.classlist=
+bytecode.dump.bytecode=false
+bytecode.dump.verify=false
+bytecode.dump.asm=false
+
 ###########################################################
 # application type                                        # 
 ###########################################################


Test patch:
diff --git a/agent/src/test/resources/pinpoint-disabled-plugin-test.config b/agent/src/test/resources/pinpoint-disabled-plugin-test.config
index 26d06b8aacdf..623d868e3591 100644
--- a/agent/src/test/resources/pinpoint-disabled-plugin-test.config
+++ b/agent/src/test/resources/pinpoint-disabled-plugin-test.config
@@ -51,7 +51,7 @@ profiler.agentInfo.send.retry.interval=300000
 profiler.tcpdatasender.command.accept.enable=true
 
 # Allow bytecode framework (JAVASSIST or ASM)
-profiler.instrument.engine=JAVASSIST
+profiler.instrument.engine=ASM
 
 
 ###########################################################