You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/08/11 09:17:07 UTC

[camel-quarkus] branch main updated: Avoid io.quarkus.platform:quarkus-bom usage in perf-regression module

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 7977de0d72 Avoid io.quarkus.platform:quarkus-bom usage in perf-regression module
7977de0d72 is described below

commit 7977de0d7213e174170ba7bc130a0683d75e3aee
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Aug 11 07:26:59 2022 +0100

    Avoid io.quarkus.platform:quarkus-bom usage in perf-regression module
    
    Fixes #3979
---
 pom.xml                                            |  2 ++
 tooling/perf-regression/pom.xml                    | 24 +++++++++++------
 .../performance/regression/FileEditionHelper.java  |  8 +++---
 .../performance/regression/MvnwCmdHelper.java      | 20 +++++++++-----
 .../regression/PerfRegressionCommand.java          | 31 +++++++++++++---------
 .../regression/PerformanceRegressionReport.java    |  9 ++++---
 6 files changed, 60 insertions(+), 34 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9b1b1306e7..166c1f4385 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,6 +79,7 @@
         <commons-beanutils.version>${commons-beanutils-version}</commons-beanutils.version>
         <commons-cli.version>1.4</commons-cli.version><!-- keep in sync with Quarkus, via quarkus-bootstrap-core -->
         <commons-collections.version>3.2.2</commons-collections.version><!-- used by hbase, should be pretty stable as commons-collections are not developed actively anymore -->
+        <commons-exec.version>${commons-exec-version}</commons-exec.version>
         <commons-lang.version>2.6</commons-lang.version><!-- used by hbase, should be pretty stable as commons-lang is not developed actively anymore -->
         <commons-math3.version>3.6.1</commons-math3.version><!-- Mess in the transitive dependencies of Spark and hbase-testing-util -->
         <curator.version>4.3.0</curator.version><!-- Mess in the transitive dependencies of Spark, Zookeeper and other hadoop related components -->
@@ -129,6 +130,7 @@
         <smallrye.reactive.messaging.camel.version>3.18.0</smallrye.reactive.messaging.camel.version><!-- @sync io.quarkus:quarkus-bom:${quarkus.version} dep:io.smallrye.reactive:smallrye-reactive-messaging-provider -->
         <spring.version>${spring5-version}</spring.version>
         <snakeyaml.version>${snakeyaml-version}</snakeyaml.version>
+        <tablesaw.version>0.43.1</tablesaw.version>
         <threetenbp.version>1.6.0</threetenbp.version>
         <xalan.version>${xalan-version}</xalan.version>
         <xchange.version>${xchange-version}</xchange.version>
diff --git a/tooling/perf-regression/pom.xml b/tooling/perf-regression/pom.xml
index 9624b44eab..c41ced90e3 100644
--- a/tooling/perf-regression/pom.xml
+++ b/tooling/perf-regression/pom.xml
@@ -17,26 +17,36 @@
     limitations under the License.
 
 -->
-<project
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
-    xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"  xmlns="http://maven.apache.org/POM/4.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
-        <artifactId>camel-quarkus-tooling</artifactId>
+        <artifactId>camel-quarkus-build-parent</artifactId>
         <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent/pom.xml</relativePath>
     </parent>
+
     <artifactId>perf-regression</artifactId>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
-                <groupId>io.quarkus.platform</groupId>
+                <groupId>io.quarkus</groupId>
                 <artifactId>quarkus-bom</artifactId>
                 <version>${quarkus.version}</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-exec</artifactId>
+                <version>${commons-exec.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>tech.tablesaw</groupId>
+                <artifactId>tablesaw-core</artifactId>
+                <version>${tablesaw.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <dependencies>
@@ -47,12 +57,10 @@
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-exec</artifactId>
-            <version>1.3</version>
         </dependency>
         <dependency>
             <groupId>tech.tablesaw</groupId>
             <artifactId>tablesaw-core</artifactId>
-            <version>0.43.1</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
diff --git a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/FileEditionHelper.java b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/FileEditionHelper.java
index f95d178a3f..f56ca5ca79 100644
--- a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/FileEditionHelper.java
+++ b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/FileEditionHelper.java
@@ -33,7 +33,8 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 public class FileEditionHelper {
 
     // We merely set the duration in the hyperfoil benchmark template
-    public static void instantiateHyperfoilBenchmark(Path cqVersionUnderTestFolder, String singleScenarioDuration) throws IOException {
+    public static void instantiateHyperfoilBenchmark(Path cqVersionUnderTestFolder, String singleScenarioDuration)
+            throws IOException {
         File benchmarkFile = cqVersionUnderTestFolder.resolve("cq-perf-regression-scenario.hf.yaml").toFile();
         String benchmarkFileContent = FileUtils.readFileToString(benchmarkFile, StandardCharsets.UTF_8);
         benchmarkFileContent = benchmarkFileContent.replaceAll("372f6453-7527-43b1-850b-3824fc3d1187", singleScenarioDuration);
@@ -41,8 +42,9 @@ public class FileEditionHelper {
     }
 
     // We set the parent version and add staging repositories if needed
-    public static void instantiatePomFile(Path cqVersionUnderTestFolder, String cqVersion, String cqStagingRepositoryUrl, String camelStagingRepositoryUrl)
-        throws IOException, XmlPullParserException {
+    public static void instantiatePomFile(Path cqVersionUnderTestFolder, String cqVersion, String cqStagingRepositoryUrl,
+            String camelStagingRepositoryUrl)
+            throws IOException, XmlPullParserException {
         File pomFile = cqVersionUnderTestFolder.resolve("pom.xml").toFile();
 
         try (FileReader fileReader = new FileReader(pomFile, StandardCharsets.UTF_8)) {
diff --git a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java
index 21797cb5e4..9568de574c 100644
--- a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java
+++ b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java
@@ -45,11 +45,15 @@ public class MvnwCmdHelper {
             File logFile = cqVersionUnderTestFolder.resolve("logs.txt").toFile();
             stdoutFileStream = new FileOutputStream(logFile, true);
 
-            stdoutFileStream.write("\n\n**********************************************************************\n".getBytes(StandardCharsets.UTF_8));
-            stdoutFileStream.write("**********************************************************************\n".getBytes(StandardCharsets.UTF_8));
-            stdoutFileStream.write(("** "+cmd+"\n").getBytes(StandardCharsets.UTF_8));
-            stdoutFileStream.write("**********************************************************************\n".getBytes(StandardCharsets.UTF_8));
-            stdoutFileStream.write("**********************************************************************\n".getBytes(StandardCharsets.UTF_8));
+            stdoutFileStream.write("\n\n**********************************************************************\n"
+                    .getBytes(StandardCharsets.UTF_8));
+            stdoutFileStream.write("**********************************************************************\n"
+                    .getBytes(StandardCharsets.UTF_8));
+            stdoutFileStream.write(("** " + cmd + "\n").getBytes(StandardCharsets.UTF_8));
+            stdoutFileStream.write("**********************************************************************\n"
+                    .getBytes(StandardCharsets.UTF_8));
+            stdoutFileStream.write("**********************************************************************\n"
+                    .getBytes(StandardCharsets.UTF_8));
 
             teeOutputStream = new TeeOutputStream(stdoutAndStderrMemoryStream, stdoutFileStream);
             DefaultExecutor executor = new DefaultExecutor();
@@ -60,12 +64,14 @@ public class MvnwCmdHelper {
             int exitValue = executor.execute(cmd);
             String outAndErr = stdoutAndStderrMemoryStream.toString(StandardCharsets.UTF_8);
             if (exitValue != 0) {
-                throw new RuntimeException("The command '" + cmd + "' has returned exitValue " + exitValue + ", process logs below:\n" + outAndErr);
+                throw new RuntimeException("The command '" + cmd + "' has returned exitValue " + exitValue
+                        + ", process logs below:\n" + outAndErr);
             }
 
             return outAndErr;
         } catch (IOException ex) {
-            throw new RuntimeException("An issue occurred while attempting to execute 'mvnw " + args + "', more logs may be found in " + cqVersionUnderTestFolder + "/logs.txt if exists", ex);
+            throw new RuntimeException("An issue occurred while attempting to execute 'mvnw " + args
+                    + "', more logs may be found in " + cqVersionUnderTestFolder + "/logs.txt if exists", ex);
         } finally {
             IOUtils.closeQuietly(stdoutAndStderrMemoryStream);
             IOUtils.closeQuietly(stdoutFileStream);
diff --git a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java
index ad8f04878b..8703fb99d1 100644
--- a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java
+++ b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java
@@ -24,7 +24,6 @@ import java.nio.file.Paths;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.RegExUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
 import picocli.CommandLine.Option;
 import picocli.CommandLine.Parameters;
 
@@ -36,16 +35,20 @@ public class PerfRegressionCommand implements Runnable {
     @Parameters(paramLabel = "<versions>", arity = "1..*", description = "A list of versions, e.g: 2.7.0 2.8.0-SNAPSHOT")
     private String[] cqVersions = {};
 
-    @Option(names = {"-cqs", "--camel-quarkus-staging-repository"}, description = "Camel Quarkus staging repository, e.g: https://repository.apache.org/content/repositories/orgapachecamel-1423")
+    @Option(names = { "-cqs",
+            "--camel-quarkus-staging-repository" }, description = "Camel Quarkus staging repository, e.g: https://repository.apache.org/content/repositories/orgapachecamel-1423")
     private String cqStagingRepository;
 
-    @Option(names = {"-cs", "--camel-staging-repository"}, description = "Camel staging repository, e.g: https://repository.apache.org/content/repositories/orgapachecamel-1424")
+    @Option(names = { "-cs",
+            "--camel-staging-repository" }, description = "Camel staging repository, e.g: https://repository.apache.org/content/repositories/orgapachecamel-1424")
     private String camelStagingRepository;
 
-    @Option(names = {"-d", "--duration"}, defaultValue = "10m", description = "The duration of a single performance test scenario (e.g. 45s, 30m, 1h). Up to 2 scenarios per version could be run.")
+    @Option(names = { "-d",
+            "--duration" }, defaultValue = "10m", description = "The duration of a single performance test scenario (e.g. 45s, 30m, 1h). Up to 2 scenarios per version could be run.")
     private String singleScenarioDuration;
 
-    @Option(names = {"-an", "--also-run-native-mode"}, description = "Tells whether the throughput test should also be run in native mode. By default, run in JVM mode only.")
+    @Option(names = { "-an",
+            "--also-run-native-mode" }, description = "Tells whether the throughput test should also be run in native mode. By default, run in JVM mode only.")
     private boolean alsoRunNativeMode;
 
     @Override
@@ -62,12 +65,13 @@ public class PerfRegressionCommand implements Runnable {
             }
 
             System.out.println(report.printAll());
-        } catch (IOException|XmlPullParserException e) {
+        } catch (IOException | XmlPullParserException e) {
             throw new RuntimeException("An issue has been caught while trying to setup performance regression tests.", e);
         }
     }
 
-    private void runPerfRegressionForCqVersion(Path cqVersionUnderTestFolder, String cqVersion, PerformanceRegressionReport report) throws IOException, XmlPullParserException {
+    private void runPerfRegressionForCqVersion(Path cqVersionUnderTestFolder, String cqVersion,
+            PerformanceRegressionReport report) throws IOException, XmlPullParserException {
         // Copy the template project into a folder dedicated to cqVersion tests
         FileUtils.copyDirectory(PERF_SAMPLE_TEMPLATE_FOLDER.toFile(), cqVersionUnderTestFolder.toFile());
 
@@ -85,21 +89,24 @@ public class PerfRegressionCommand implements Runnable {
         report.setCategoryMeasureForVersion(cqVersion, "JVM", jvmThroughput);
 
         // Run performance regression test in native mode
-        if(alsoRunNativeMode) {
-            double nativeThroughput = runPerfRegression(cqVersionUnderTestFolder, "integration-test -Dnative -Dquarkus.native.container-build=true");
+        if (alsoRunNativeMode) {
+            double nativeThroughput = runPerfRegression(cqVersionUnderTestFolder,
+                    "integration-test -Dnative -Dquarkus.native.container-build=true");
             report.setCategoryMeasureForVersion(cqVersion, "Native", nativeThroughput);
         }
     }
 
     private static String getTargetMavenVersion(Path cqVersionUnderTestFolder) {
-        String stdoutAndStdErr = MvnwCmdHelper.execute(cqVersionUnderTestFolder, "help:evaluate -Dexpression='target-maven-version' -q -DforceStdout");
-        String targetMavenVersion = stdoutAndStdErr.substring(stdoutAndStdErr.lastIndexOf(System.lineSeparator())+System.lineSeparator().length());
+        String stdoutAndStdErr = MvnwCmdHelper.execute(cqVersionUnderTestFolder,
+                "help:evaluate -Dexpression='target-maven-version' -q -DforceStdout");
+        String targetMavenVersion = stdoutAndStdErr
+                .substring(stdoutAndStdErr.lastIndexOf(System.lineSeparator()) + System.lineSeparator().length());
 
         return "null object or invalid expression".equals(targetMavenVersion) ? "3.8.1" : targetMavenVersion;
     }
 
     private static void setMvnwMavenVersion(Path cqVersionUnderTestFolder, String targetMavenVersion) {
-        MvnwCmdHelper.execute(cqVersionUnderTestFolder, "wrapper:wrapper -Dmaven="+targetMavenVersion);
+        MvnwCmdHelper.execute(cqVersionUnderTestFolder, "wrapper:wrapper -Dmaven=" + targetMavenVersion);
     }
 
     private static double runPerfRegression(Path cqVersionUnderTestFolder, String args) {
diff --git a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerformanceRegressionReport.java b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerformanceRegressionReport.java
index 08588c7b12..efd54ebe8f 100644
--- a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerformanceRegressionReport.java
+++ b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerformanceRegressionReport.java
@@ -21,14 +21,13 @@ import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.maven.artifact.versioning.ComparableVersion;
-
 import tech.tablesaw.api.StringColumn;
 import tech.tablesaw.api.Table;
 
 /**
  * Provide a human readable performance regression report ready to be printed to
  * the console. For each camel-quarkus version, the report will print:
- * + The throughput for each measure in a category (JVM, Native) in a new column 
+ * + The throughput for each measure in a category (JVM, Native) in a new column
  * + The percent increase throughput compared to the previous row in the same column
  */
 public class PerformanceRegressionReport {
@@ -62,7 +61,8 @@ public class PerformanceRegressionReport {
             boolean regressionDetected = false;
 
             double jvmMeasure = measurePerVersion.getValue().get("JVM");
-            double percentIncreaseJvm = (previousJvmMeasure == Double.POSITIVE_INFINITY) ? 0.0 : ((jvmMeasure / previousJvmMeasure) - 1.0) * 100.0;
+            double percentIncreaseJvm = (previousJvmMeasure == Double.POSITIVE_INFINITY) ? 0.0
+                    : ((jvmMeasure / previousJvmMeasure) - 1.0) * 100.0;
             jvmMeasuresColumn.append(String.format("%.2f req/s [%+.2f%%]", jvmMeasure, percentIncreaseJvm));
             previousJvmMeasure = jvmMeasure;
             if (percentIncreaseJvm <= -5.00) {
@@ -71,7 +71,8 @@ public class PerformanceRegressionReport {
 
             if (measurePerVersion.getValue().containsKey("Native")) {
                 double nativeMeasure = measurePerVersion.getValue().get("Native");
-                double percentIncreaseNative = (previousNativeMeasure == Double.POSITIVE_INFINITY) ? 0.0 : ((nativeMeasure / previousNativeMeasure) - 1.0) * 100.0;
+                double percentIncreaseNative = (previousNativeMeasure == Double.POSITIVE_INFINITY) ? 0.0
+                        : ((nativeMeasure / previousNativeMeasure) - 1.0) * 100.0;
                 nativeMeasuresColumn.append(String.format("%.2f req/s [%+.2f%%]", nativeMeasure, percentIncreaseNative));
                 previousNativeMeasure = nativeMeasure;
                 if (percentIncreaseNative <= -5.00) {