perf: add JVM flags for faster agent cold start

Use -XX:TieredStopAtLevel=1 and -XX:+UseSerialGC to skip C2
compilation and reduce GC init overhead on agent process startup.
This commit is contained in:
t8y2
2026-05-13 16:33:39 +08:00
parent 5e30e97be4
commit adb320192a
+1 -2
View File
@@ -22,8 +22,7 @@ impl AgentDriverClient {
/// Blocks (async) until the agent writes `{"ready":true}` to stdout.
pub async fn spawn(java_path: &str, jar_path: &str) -> Result<Self, String> {
let mut child = Command::new(java_path)
.arg("-jar")
.arg(jar_path)
.args(["-XX:TieredStopAtLevel=1", "-XX:+UseSerialGC", "-jar", jar_path])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::inherit())