Add jdk28-zgc: ZGC startup and warmup baseline on JDK 25/27/28-ea, and a probe for JEP 545/546
Spring Boot 4.1.1 harness measuring first-response time versus initial heap size and a 20,000-request warmup. Shows -XX:+ZAdaptiveHeapSizing is not yet in any build. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WzVQ6zFh9cuLPj9RSbRH8U
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.ankurm.zgc;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/** Smallest useful server: one cheap endpoint, one endpoint that reports heap state. */
|
||||
@SpringBootApplication
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
@RestController
|
||||
static class Api {
|
||||
private final byte[][] garbage = new byte[64][];
|
||||
private int i;
|
||||
|
||||
/** Allocates a little so ZGC has something to do. */
|
||||
@GetMapping("/hello")
|
||||
String hello() {
|
||||
garbage[i++ & 63] = new byte[16 * 1024];
|
||||
return "ok";
|
||||
}
|
||||
|
||||
@GetMapping("/heap")
|
||||
Map<String, Object> heap() {
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
Map<String, Object> m = new LinkedHashMap<>();
|
||||
m.put("javaVersion", System.getProperty("java.version"));
|
||||
m.put("committedMiB", rt.totalMemory() >> 20);
|
||||
m.put("maxMiB", rt.maxMemory() >> 20);
|
||||
m.put("gc", ManagementFactory.getGarbageCollectorMXBeans().stream().map(b -> b.getName()).toList());
|
||||
m.put("jvmUptimeMs", ManagementFactory.getRuntimeMXBean().getUptime());
|
||||
return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user