Skip to content

Commit

Permalink
Improves aarch64 compatibility (hyperfoil), plus small fixes
Browse files Browse the repository at this point in the history
Check if executable exists first
amd64/arm64 Hyperfoil, thresholds props
Fiddle with CPU boost only where supported
Cleanup imageio cache font files, Whitelist podman
Relaxes <= 0 to < 0 for measurements as diff of size 0 is valid
  • Loading branch information
Karm committed Sep 7, 2023
1 parent 9e740ab commit dab9492
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 25 deletions.
4 changes: 4 additions & 0 deletions apps/debug-symbols-smoke/threshold.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ linux.diff_jvm.time.to.finish.threshold.ms=20
linux.diff_native.time.to.finish.threshold.ms=30
windows.diff_jvm.time.to.finish.threshold.ms=20
windows.diff_native.time.to.finish.threshold.ms=30
linux.container.jvm.time.to.finish.threshold.ms=6924
linux.container.native.time.to.finish.threshold.ms=14525
linux.container.diff_jvm.time.to.finish.threshold.ms=20
linux.container.diff_native.time.to.finish.threshold.ms=30
4 changes: 4 additions & 0 deletions apps/quarkus-spöklik-encoding/threshold.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ linux.executable.size.threshold.kB=44800
windows.time.to.first.ok.request.threshold.ms=1100
windows.RSS.threshold.kB=55000
windows.executable.size.threshold.kB=30478

linux.container.executable.size.threshold.kB=44800
linux.container.time.to.first.ok.request.threshold.ms=1500
linux.container.RSS.threshold.kB=55000
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.graalvm.tests.integration.DebugSymbolsTest.DebugOptions.DebugCodeInfoUseSourceMappings_23_0;
Expand Down Expand Up @@ -646,11 +647,25 @@ public void imageioAWT(TestInfo testInfo, Apps app) throws IOException, Interrup
if (metaINF.exists()) {
FileUtils.cleanDirectory(metaINF);
}
new File(appDir, "dependency-reduced-pom.xml").delete();
final File fontConfigDir = new File(appDir, "?");
if (fontConfigDir.exists()) {
FileUtils.forceDelete(fontConfigDir);
}
Stream.of(
new File(appDir, "?"),
new File(appDir, ".cache"),
new File(appDir, ".java"),
new File(appDir, "dependency-reduced-pom.xml")
).forEach(f -> {
try {
if (f.exists()) {
if (f.isDirectory()) {
FileUtils.deleteDirectory(f);
} else {
f.delete();
}
}
} catch (IOException e) {
// We ignore it...
e.printStackTrace();
}
});
controlData.keySet().forEach(f -> new File(appDir, f).delete());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public void testRuntime(TestInfo testInfo, Apps app) throws IOException, Interru
}
long buildEnds = System.currentTimeMillis();
assertTrue(processLog.exists());
assertTrue(findExecutable(Path.of(appDir.getAbsolutePath(), "target"), Pattern.compile(".*")).exists(),
"No executable found. Compilation failed. Check the logs.");

// Run
LOGGER.info("Running...");
Expand Down Expand Up @@ -146,6 +148,7 @@ public void testRuntime(TestInfo testInfo, Apps app) throws IOException, Interru
.build();
// Running as a container
} else {
// -runner is a Quarkus specific name, but we don't test Helidon in container anyway...
executableSizeKb = findExecutable(Path.of(appDir.getAbsolutePath(), "target"),
Pattern.compile(".*-runner")).length() / 1024L;
rssKb = getContainerMemoryKb(app.runtimeContainer.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,13 @@ public enum BuildAndRunCmds {
"-XX:+FlightRecorder",
"-XX:StartFlightRecording=settings=" + BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/jfr-perf.jfc,filename=logs/flight-native.jfr",
"-XX:FlightRecorderLogging=jfr"},
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/hyperfoil/hyperfoil:0.25.2", "standalone"}
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/karmkarm/hyperfoil:0.25.2", "standalone"}
}),
PLAINTEXT_PERFORMANCE(new String[][]{
new String[]{"mvn", "clean", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(),
"-DfinalName=jfr-plaintext"},
new String[]{"./target/jfr-plaintext-runner"},
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/hyperfoil/hyperfoil:0.25.2", "standalone"}
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/karmkarm/hyperfoil:0.25.2", "standalone"}
}),
JFR_PERFORMANCE_BUILDER_IMAGE(new String[][]{
new String[]{"mvn", "clean", "package", "-Pnative", "-Dquarkus.native.container-build=true",
Expand All @@ -250,7 +250,7 @@ public enum BuildAndRunCmds {
"--name", ContainerNames.JFR_PERFORMANCE_BUILDER_IMAGE.name, "jfr-performance-app", "-XX:+FlightRecorder",
"-XX:StartFlightRecording=settings=/work/jfr-perf.jfc,filename=/tmp/flight-native.jfr",
"-XX:FlightRecorderLogging=jfr"},
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/hyperfoil/hyperfoil:0.25.2", "standalone"}
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/karmkarm/hyperfoil:0.25.2", "standalone"}
}),
PLAINTEXT_PERFORMANCE_BUILDER_IMAGE(new String[][]{
new String[]{"mvn", "clean", "package", "-Pnative", "-Dquarkus.native.container-build=true",
Expand All @@ -263,7 +263,7 @@ public enum BuildAndRunCmds {
"-t",
//"-v", BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/logs:/tmp:z",
"--name", ContainerNames.JFR_PLAINTEXT_BUILDER_IMAGE.name, "jfr-plaintext-app"},
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/hyperfoil/hyperfoil:0.25.2", "standalone"}
new String[]{CONTAINER_RUNTIME, "run", "--name", ContainerNames.HYPERFOIL.name, "--rm", "--network=host", "quay.io/karmkarm/hyperfoil:0.25.2", "standalone"}
}),
JFR_SMOKE(new String[][]{
new String[]{"mvn", "package"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ public static boolean waitForContainerLogToMatch(String containerName, Pattern p
long timeoutMillis = unit.toMillis(timeout);
long sleepMillis = unit.toMillis(sleep);
long startMillis = System.currentTimeMillis();
final ProcessBuilder processBuilder = new ProcessBuilder(getRunCommand(CONTAINER_RUNTIME, "logs", containerName));
final List<String> cmd = getRunCommand(CONTAINER_RUNTIME, "logs", containerName);
LOGGER.infof("Command: %s", cmd);
final ProcessBuilder processBuilder = new ProcessBuilder(cmd);
final Map<String, String> envA = processBuilder.environment();
envA.put("PATH", System.getenv("PATH"));
processBuilder.redirectErrorStream(true);
Expand Down Expand Up @@ -431,6 +433,7 @@ public static void stopRunningContainers(String... containerNames) throws Interr

public static void stopRunningContainer(String containerName) throws InterruptedException, IOException {
final List<String> cmd = new ArrayList<>(getRunCommand(CONTAINER_RUNTIME, "stop", containerName));
LOGGER.infof("Command: %s", cmd);
final Process process = Runtime.getRuntime().exec(cmd.toArray(String[]::new));
process.waitFor(5, TimeUnit.SECONDS);
}
Expand All @@ -443,6 +446,7 @@ public static void removeContainers(String... containerNames) throws Interrupted

public static void removeContainer(String containerName) throws InterruptedException, IOException {
final List<String> cmd = new ArrayList<>(getRunCommand(CONTAINER_RUNTIME, "rm", containerName, "--force"));
LOGGER.infof("Command: %s", cmd);
final Process process = Runtime.getRuntime().exec(cmd.toArray(String[]::new));
process.waitFor(5, TimeUnit.SECONDS);
}
Expand All @@ -456,8 +460,10 @@ public static void removeContainer(String containerName) throws InterruptedExcep
13.43MiB / 11.28GiB
*/
public static long getContainerMemoryKb(String containerName) throws IOException, InterruptedException {
final ProcessBuilder pa = new ProcessBuilder(getRunCommand(
CONTAINER_RUNTIME, "stats", "--no-stream", "--format", "table {{.MemUsage}}", containerName));
final List<String> cmd = getRunCommand(
CONTAINER_RUNTIME, "stats", "--no-stream", "--format", "table {{.MemUsage}}", containerName);
LOGGER.infof("Command: %s", cmd);
final ProcessBuilder pa = new ProcessBuilder(cmd);
final Map<String, String> envA = pa.environment();
envA.put("PATH", System.getenv("PATH"));
pa.redirectErrorStream(true);
Expand All @@ -468,6 +474,10 @@ public static long getContainerMemoryKb(String containerName) throws IOException
while ((l = processOutputReader.readLine()) != null) {
if (l.contains("Error")) {
LOGGER.error("Container: " + l);
if (l.contains("No such container: {{.MemUsage}}")) {
LOGGER.error("You don't have the right to call `stats' on " + containerName + " container. " +
"You might have to set " + ("podman".equals(CONTAINER_RUNTIME) ? "PODMAN_WITH_SUDO" : "DOCKER_WITH_SUDO") + " to true.");
}
break;
}
final Matcher m = CONTAINER_STATS_MEMORY.matcher(l);
Expand Down Expand Up @@ -587,26 +597,50 @@ public static void processStopper(Process p, boolean force, boolean orderMatters

public static void clearCaches() throws IOException {
if (IS_THIS_WINDOWS) {
throw new UnsupportedOperationException("Not implemented for Windows");
LOGGER.infof("Not implemented for Windows");
return;
}
final List<String> cmd = getRunCommand("sudo", "bash", "-c", "sync; echo 3 > /proc/sys/vm/drop_caches");
LOGGER.infof("Command: %s, Output: %s", cmd, runCommand(cmd));
}

public static void disableTurbo() throws IOException {
if (IS_THIS_WINDOWS) {
throw new UnsupportedOperationException("Not implemented for Windows");
LOGGER.infof("Not implemented for Windows");
return;
}
final List<String> cmd = getRunCommand("sudo", "bash", "-c", "echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo");
LOGGER.infof("Command: %s, Output: %s", cmd, runCommand(cmd));
final File intel = new File("/sys/devices/system/cpu/intel_pstate/no_turbo");
if (intel.exists()) {
final List<String> cmd = getRunCommand("sudo", "bash", "-c", "echo 1 > " + intel.getAbsolutePath());
LOGGER.infof("Command: %s, Output: %s", cmd, runCommand(cmd));
return;
}
final File amd = new File("/sys/devices/system/cpu/cpufreq/boost");
if (amd.exists()) {
final List<String> cmd = getRunCommand("sudo", "bash", "-c", "echo 0 > " + amd.getAbsolutePath());
LOGGER.infof("Command: %s, Output: %s", cmd, runCommand(cmd));
return;
}
LOGGER.infof("Neither Intel nor AMD turbo boost control found. This is either a vm or a different system.");
}

public static void enableTurbo() throws IOException {
if (IS_THIS_WINDOWS) {
throw new UnsupportedOperationException("Not implemented for Windows");
LOGGER.infof("Not implemented for Windows");
}
final File intel = new File("/sys/devices/system/cpu/intel_pstate/no_turbo");
if (intel.exists()) {
final List<String> cmd = getRunCommand("sudo", "bash", "-c", "echo 0 > " + intel.getAbsolutePath());
LOGGER.infof("Command: %s, Output: %s", cmd, runCommand(cmd));
return;
}
final File amd = new File("/sys/devices/system/cpu/cpufreq/boost");
if (amd.exists()) {
final List<String> cmd = getRunCommand("sudo", "bash", "-c", "echo 1 > " + amd.getAbsolutePath());
LOGGER.infof("Command: %s, Output: %s", cmd, runCommand(cmd));
return;
}
final String[] cmd = new String[]{"sudo", "bash", "-c", "echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo"};
LOGGER.infof("Command: %s, Output: %s", String.join(" ", cmd), runCommand(getRunCommand(cmd)));
LOGGER.infof("Neither Intel nor AMD turbo boost control found. This is either a vm or a different system.");
}

public static class ProcessRunner implements Runnable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,39 +66,39 @@ public Log(String headerCSV, String headerMarkdown, String lineCSV, String lineM
private String app = null;

public LogBuilder buildTimeMs(long buildTimeMs) {
if (buildTimeMs <= 0) {
if (buildTimeMs < 0) {
throw new IllegalArgumentException("buildTimeMs must be a positive long, was: " + buildTimeMs);
}
this.buildTimeMs = buildTimeMs;
return this;
}

public LogBuilder timeToFirstOKRequestMs(long timeToFirstOKRequestMs) {
if (timeToFirstOKRequestMs <= 0) {
if (timeToFirstOKRequestMs < 0) {
throw new IllegalArgumentException("timeToFirstOKRequestMs must be a positive long, was: " + timeToFirstOKRequestMs);
}
this.timeToFirstOKRequestMs = timeToFirstOKRequestMs;
return this;
}

public LogBuilder timeToFinishMs(long timeToFinishMs) {
if (timeToFinishMs <= 0) {
if (timeToFinishMs < 0) {
throw new IllegalArgumentException("timeToFinishMs must be a positive long, was: " + timeToFinishMs);
}
this.timeToFinishMs = timeToFinishMs;
return this;
}

public LogBuilder executableSizeKb(long executableSizeKb) {
if (executableSizeKb <= 0) {
if (executableSizeKb < 0) {
throw new IllegalArgumentException("executableSizeKb must be a positive long, was: " + executableSizeKb);
}
this.executableSizeKb = executableSizeKb;
return this;
}

public LogBuilder rssKb(long rssKb) {
if (rssKb <= 0) {
if (rssKb < 0) {
throw new IllegalArgumentException("rssKb must be a positive long, was: " + rssKb);
}
this.rssKb = rssKb;
Expand Down Expand Up @@ -141,7 +141,7 @@ public LogBuilder responseTime99Percentile(long responseTime99Percentile) {
}

public LogBuilder openedFiles(long openedFiles) {
if (openedFiles <= 0) {
if (openedFiles < 0) {
throw new IllegalArgumentException("openedFiles must be a positive long, was: " + openedFiles);
}
this.openedFiles = openedFiles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ public Pattern[] get(boolean inContainer) {
Pattern.compile(".*ControllerVerticle] Uncaught error: java.lang.NullPointerException.*"),
// For some reason, Podman spits this when terminating Hyperfoil containers
Pattern.compile(".*Could not retrieve exit code from event: died not found: unable to find event.*"),
// Again Hyperfoil and Podman. There might be something odd with stopping those agents? Not a Quaruks/Mandrel issue.
Pattern.compile(".*Waiting for container .* getting exit code of container .* from DB: no such exit code \\(container in state running\\).*"),
// Quarkus 3.x intermittently with JDK 20 based build...
Pattern.compile(".*io.net.boo.ServerBootstrap.*Failed to register an accepted channel:.*")
};
Expand Down

0 comments on commit dab9492

Please sign in to comment.