You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/03/01 10:29:45 UTC

[camel-performance-tests] branch camel-3.x updated (6e7defb -> d105fc5)

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

orpiske pushed a change to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git


    from 6e7defb  ci: also run the build for Camel 3.x branch
     new 8965b1a  Added a few simple seda tests to stress the core
     new 197d677  (chores): increase timeout duration to avoid problems with long-running tests
     new 0d62978  Added support for saving the results to json for easier automation
     new 52726cf  Added more type variability in the route tests
     new 09f7596  Cleanup DirectConcurrentTest
     new d105fc5  Use pre-created endpoints to avoid the extra cost associated with resolving them

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |   1 +
 .../itest/jmh/BlockingProducerToSedaTest.java      |  99 ++++++++++++++++++++
 ...ngProducerWithArrayBlockingQueueToSedaTest.java | 102 ++++++++++++++++++++
 .../camel/itest/jmh/CSimpleOperatorTest.java       |   3 +
 .../camel/itest/jmh/ContextStartStopTest.java      |  70 ++++++++++++++
 .../camel/itest/jmh/DirectConcurrentTest.java      |  34 +++++--
 .../camel/itest/jmh/FastTypeConverterTest.java     |   3 +
 .../java/org/apache/camel/itest/jmh/JoorTest.java  |   3 +
 .../apache/camel/itest/jmh/SedaRoundTripTest.java  | 103 +++++++++++++++++++++
 .../camel/itest/jmh/SimpleExpressionTest.java      |   3 +
 .../org/apache/camel/itest/jmh/SimpleMockTest.java |   3 +
 .../apache/camel/itest/jmh/SimpleOperatorTest.java |   3 +
 .../camel/itest/jmh/SlowTypeConverterTest.java     |   3 +
 .../apache/camel/itest/jmh/TypeConverterTest.java  |   3 +
 14 files changed, 427 insertions(+), 6 deletions(-)
 create mode 100644 tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
 create mode 100644 tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerWithArrayBlockingQueueToSedaTest.java
 create mode 100644 tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java
 create mode 100644 tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java


[camel-performance-tests] 06/06: Use pre-created endpoints to avoid the extra cost associated with resolving them

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit d105fc55a2ef67adc3f806a461aac22ed5d74ebd
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Mar 1 10:13:01 2023 +0100

    Use pre-created endpoints to avoid the extra cost associated with resolving them
---
 .../itest/jmh/BlockingProducerToSedaTest.java      | 16 ++++++++-----
 .../camel/itest/jmh/DirectConcurrentTest.java      | 15 ++++++++-----
 .../apache/camel/itest/jmh/SedaRoundTripTest.java  | 26 +++++++++++++---------
 3 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
index 59b9a64..58586f3 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
@@ -4,6 +4,7 @@ import java.io.File;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
@@ -48,6 +49,8 @@ public class BlockingProducerToSedaTest {
 
         CamelContext context;
         ProducerTemplate producerTemplate;
+        Endpoint endpoint;
+
         File sampleFile = new File("some-file");
         Integer someInt = Integer.valueOf(1);
         Long someLong = Long.valueOf(2);
@@ -57,6 +60,7 @@ public class BlockingProducerToSedaTest {
             context = new DefaultCamelContext();
 
             producerTemplate = context.createProducerTemplate();
+            endpoint = context.getEndpoint("seda:test?blockWhenFull=true&offerTimeout=1000");
 
             context.addRoutes(new RouteBuilder() {
                 @Override
@@ -64,7 +68,7 @@ public class BlockingProducerToSedaTest {
                     onException(IllegalStateException.class)
                             .process(e -> System.out.println("The SEDA queue is likely full and the system may be unable to catch to the load. Fix the test parameters"));
 
-                    fromF("seda:test").to("log: ${body}");
+                    fromF("seda:test").to("log:?level=OFF");
 
                 }
             });
@@ -77,7 +81,7 @@ public class BlockingProducerToSedaTest {
     @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
     @Benchmark
     public void sendBlocking(BlockingProducerToSedaTest.BenchmarkState state, Blackhole bh) {
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", "test");
+        state.producerTemplate.sendBody(state.endpoint, "test");
     }
 
 
@@ -85,10 +89,10 @@ public class BlockingProducerToSedaTest {
     @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
     @Benchmark
     public void sendBlockingWithMultipleTypes(BlockingProducerToSedaTest.BenchmarkState state, Blackhole bh) {
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", "test");
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someInt);
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someLong);
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.sampleFile);
+        state.producerTemplate.sendBody(state.endpoint, "test");
+        state.producerTemplate.sendBody(state.endpoint, state.someInt);
+        state.producerTemplate.sendBody(state.endpoint, state.someLong);
+        state.producerTemplate.sendBody(state.endpoint, state.sampleFile);
     }
 
 
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
index b5632bb..09d8b51 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
@@ -72,6 +73,8 @@ public class DirectConcurrentTest {
     public static class BenchmarkState {
         CamelContext camel;
         ProducerTemplate producer;
+        Endpoint endpoint;
+
         String someString = "test1";
         File sampleFile = new File("some-file");
         Integer someInt = Integer.valueOf(1);
@@ -80,6 +83,8 @@ public class DirectConcurrentTest {
         @Setup(Level.Trial)
         public void initialize() {
             camel = new DefaultCamelContext();
+            endpoint = camel.getEndpoint("direct:start");
+
             try {
                 camel.addRoutes(new RouteBuilder() {
                     @Override
@@ -121,15 +126,15 @@ public class DirectConcurrentTest {
 
     @Benchmark
     public void directConcurrentTest(BenchmarkState state, Blackhole bh) {
-        state.producer.sendBody("direct:start", state.someString);
+        state.producer.sendBody(state.endpoint, state.someString);
     }
 
     @Benchmark
     public void directConcurrentTestWithMultipleTypes(BenchmarkState state, Blackhole bh) {
-        state.producer.sendBody("direct:start", state.someString);
-        state.producer.sendBody("direct:start", state.someInt);
-        state.producer.sendBody("direct:start", state.someLong);
-        state.producer.sendBody("direct:start", state.sampleFile);
+        state.producer.sendBody(state.endpoint, state.someString);
+        state.producer.sendBody(state.endpoint, state.someInt);
+        state.producer.sendBody(state.endpoint, state.someLong);
+        state.producer.sendBody(state.endpoint, state.sampleFile);
 
     }
 
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
index 3503e6e..a6f6479 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
@@ -5,6 +5,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.Endpoint;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
@@ -50,6 +51,8 @@ public class SedaRoundTripTest {
         CamelContext context;
         ProducerTemplate producerTemplate;
         ConsumerTemplate consumerTemplate;
+        Endpoint producerEndpoint;
+        Endpoint consumerEndpoint;
 
         String someString = "test1";
         File sampleFile = new File("some-file");
@@ -63,6 +66,9 @@ public class SedaRoundTripTest {
             producerTemplate = context.createProducerTemplate();
             consumerTemplate = context.createConsumerTemplate();
 
+            producerEndpoint = context.getEndpoint("seda:test?blockWhenFull=true&offerTimeout=1000");
+            consumerEndpoint = context.getEndpoint("seda:test");
+
             context.start();
         }
     }
@@ -71,8 +77,8 @@ public class SedaRoundTripTest {
     @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
     @Benchmark
     public void sendBlocking(SedaRoundTripTest.BenchmarkState state, Blackhole bh) {
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someString);
-        bh.consume(state.consumerTemplate.receive("seda:test"));
+        state.producerTemplate.sendBody(state.producerEndpoint, state.someString);
+        bh.consume(state.consumerTemplate.receive(state.consumerEndpoint));
     }
 
 
@@ -80,17 +86,17 @@ public class SedaRoundTripTest {
     @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
     @Benchmark
     public void sendBlockingWithMultipleTypes(SedaRoundTripTest.BenchmarkState state, Blackhole bh) {
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someString);
-        bh.consume(state.consumerTemplate.receive("seda:test"));
+        state.producerTemplate.sendBody(state.producerEndpoint, state.someString);
+        bh.consume(state.consumerTemplate.receive(state.consumerEndpoint));
 
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someLong);
-        bh.consume(state.consumerTemplate.receive("seda:test"));
+        state.producerTemplate.sendBody(state.producerEndpoint, state.someLong);
+        bh.consume(state.consumerTemplate.receive(state.consumerEndpoint));
 
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someInt);
-        bh.consume(state.consumerTemplate.receive("seda:test"));
+        state.producerTemplate.sendBody(state.producerEndpoint, state.someInt);
+        bh.consume(state.consumerTemplate.receive(state.consumerEndpoint));
 
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.sampleFile);
-        bh.consume(state.consumerTemplate.receive("seda:test"));
+        state.producerTemplate.sendBody(state.producerEndpoint, state.sampleFile);
+        bh.consume(state.consumerTemplate.receive(state.consumerEndpoint));
     }
 
 


[camel-performance-tests] 04/06: Added more type variability in the route tests

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit 52726cf1bbd8a89466e1183b1dc92af7f2299ae9
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Sat Feb 11 10:55:28 2023 +0100

    Added more type variability in the route tests
---
 .../itest/jmh/BlockingProducerToSedaTest.java      | 14 ++++++++++++-
 .../camel/itest/jmh/DirectConcurrentTest.java      | 22 +++++++++++++++++----
 .../apache/camel/itest/jmh/SedaRoundTripTest.java  | 23 +++++++++++++++++++++-
 3 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
index e76a5ba..59b9a64 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
@@ -1,5 +1,6 @@
 package org.apache.camel.itest.jmh;
 
+import java.io.File;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
@@ -47,6 +48,9 @@ public class BlockingProducerToSedaTest {
 
         CamelContext context;
         ProducerTemplate producerTemplate;
+        File sampleFile = new File("some-file");
+        Integer someInt = Integer.valueOf(1);
+        Long someLong = Long.valueOf(2);
 
         @Setup(Level.Trial)
         public void initialize() throws Exception {
@@ -77,7 +81,15 @@ public class BlockingProducerToSedaTest {
     }
 
 
-
+    @OutputTimeUnit(TimeUnit.MILLISECONDS)
+    @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
+    @Benchmark
+    public void sendBlockingWithMultipleTypes(BlockingProducerToSedaTest.BenchmarkState state, Blackhole bh) {
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", "test");
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someInt);
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someLong);
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.sampleFile);
+    }
 
 
 }
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
index 2ce0d82..66373e8 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.itest.jmh;
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
@@ -69,6 +72,10 @@ public class DirectConcurrentTest {
     public static class BenchmarkState {
         CamelContext camel;
         ProducerTemplate producer;
+        String someString = "test1";
+        File sampleFile = new File("some-file");
+        Integer someInt = Integer.valueOf(1);
+        Long someLong = Long.valueOf(2);
 
         @Setup(Level.Trial)
         public void initialize() {
@@ -114,10 +121,17 @@ public class DirectConcurrentTest {
 
     @Benchmark
     public void directConcurrentTest(BenchmarkState state, Blackhole bh) {
-        ProducerTemplate template = state.producer;
-        for (int i = 0; i < 50000; i++) {
-            template.sendBody("direct:start", "Hello " + i);
-        }
+        state.producer.sendBody("direct:start", state.someString);
+    }
+
+    @Benchmark
+    public void directConcurrentTestWithMultipleTypes(BenchmarkState state, Blackhole bh) {
+        state.producer.sendBody("direct:start", state.someString);
+        state.producer.sendBody("direct:start", state.someInt);
+        state.producer.sendBody("direct:start", state.someLong);
+        state.producer.sendBody("direct:start", state.sampleFile);
+
     }
 
+
 }
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
index 46c4390..3503e6e 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
@@ -1,5 +1,6 @@
 package org.apache.camel.itest.jmh;
 
+import java.io.File;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
@@ -50,6 +51,11 @@ public class SedaRoundTripTest {
         ProducerTemplate producerTemplate;
         ConsumerTemplate consumerTemplate;
 
+        String someString = "test1";
+        File sampleFile = new File("some-file");
+        Integer someInt = Integer.valueOf(1);
+        Long someLong = Long.valueOf(2);
+
         @Setup(Level.Trial)
         public void initialize() throws Exception {
             context = new DefaultCamelContext();
@@ -65,12 +71,27 @@ public class SedaRoundTripTest {
     @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
     @Benchmark
     public void sendBlocking(SedaRoundTripTest.BenchmarkState state, Blackhole bh) {
-        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", "test");
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someString);
         bh.consume(state.consumerTemplate.receive("seda:test"));
     }
 
 
+    @OutputTimeUnit(TimeUnit.MILLISECONDS)
+    @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
+    @Benchmark
+    public void sendBlockingWithMultipleTypes(SedaRoundTripTest.BenchmarkState state, Blackhole bh) {
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someString);
+        bh.consume(state.consumerTemplate.receive("seda:test"));
 
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someLong);
+        bh.consume(state.consumerTemplate.receive("seda:test"));
+
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.someInt);
+        bh.consume(state.consumerTemplate.receive("seda:test"));
+
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", state.sampleFile);
+        bh.consume(state.consumerTemplate.receive("seda:test"));
+    }
 
 
 }


[camel-performance-tests] 03/06: Added support for saving the results to json for easier automation

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit 0d629787caf79ed3e14b56e9963032082e1c388f
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Sat Feb 11 09:01:26 2023 +0100

    Added support for saving the results to json for easier automation
---
 .../java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java    | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/CSimpleOperatorTest.java  | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java | 3 +++
 .../test/java/org/apache/camel/itest/jmh/FastTypeConverterTest.java    | 3 +++
 tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/JoorTest.java | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java    | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/SimpleExpressionTest.java | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java       | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/SimpleOperatorTest.java   | 3 +++
 .../test/java/org/apache/camel/itest/jmh/SlowTypeConverterTest.java    | 3 +++
 .../src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java    | 3 +++
 12 files changed, 36 insertions(+)

diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
index 420c93d..e76a5ba 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
@@ -16,6 +16,7 @@ import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -32,6 +33,8 @@ public class BlockingProducerToSedaTest {
                 .measurementIterations(10)
                 .warmupIterations(5)
                 .forks(1)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CSimpleOperatorTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CSimpleOperatorTest.java
index 3336052..f94d1d8 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CSimpleOperatorTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CSimpleOperatorTest.java
@@ -33,6 +33,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -64,6 +65,8 @@ public class CSimpleOperatorTest {
                 .forks(1)
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java
index a1cbc2d..2163a2c 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java
@@ -15,6 +15,7 @@ import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -33,6 +34,8 @@ public class ContextStartStopTest {
                 .measurementIterations(10)
                 .warmupIterations(5)
                 .forks(1)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
index 97c1b06..2ce0d82 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
@@ -31,6 +31,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -55,6 +56,8 @@ public class DirectConcurrentTest {
                 .forks(1)
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/FastTypeConverterTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/FastTypeConverterTest.java
index ff0ca6d..c321f85 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/FastTypeConverterTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/FastTypeConverterTest.java
@@ -32,6 +32,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -60,6 +61,8 @@ public class FastTypeConverterTest {
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
                 .measurementBatchSize(100000)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/JoorTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/JoorTest.java
index d0f78b0..e15cbf5 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/JoorTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/JoorTest.java
@@ -34,6 +34,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -62,6 +63,8 @@ public class JoorTest {
                 .forks(1)
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
index 0e945ac..46c4390 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
@@ -17,6 +17,7 @@ import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -33,6 +34,8 @@ public class SedaRoundTripTest {
                 .measurementIterations(10)
                 .warmupIterations(5)
                 .forks(1)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleExpressionTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleExpressionTest.java
index c44781d..c548ed2 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleExpressionTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleExpressionTest.java
@@ -33,6 +33,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -60,6 +61,8 @@ public class SimpleExpressionTest {
                 .forks(1)
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java
index dcae207..57c93be 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java
@@ -32,6 +32,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -59,6 +60,8 @@ public class SimpleMockTest {
                 .forks(1)
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleOperatorTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleOperatorTest.java
index fc00074..2b7ca4d 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleOperatorTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleOperatorTest.java
@@ -33,6 +33,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -64,6 +65,8 @@ public class SimpleOperatorTest {
                 .forks(1)
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SlowTypeConverterTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SlowTypeConverterTest.java
index a044263..7985d96 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SlowTypeConverterTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SlowTypeConverterTest.java
@@ -32,6 +32,7 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -60,6 +61,8 @@ public class SlowTypeConverterTest {
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
                 .measurementBatchSize(100000)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java
index 35a5101..f5f2766 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java
@@ -24,6 +24,7 @@ import java.io.Reader;
 import java.nio.charset.StandardCharsets;
 import java.util.concurrent.TimeUnit;
 
+import org.openjdk.jmh.results.format.ResultFormatType;
 import org.w3c.dom.Document;
 
 import org.apache.camel.CamelContext;
@@ -67,6 +68,8 @@ public class TypeConverterTest {
                 .shouldFailOnError(true)
                 .shouldDoGC(true)
                 .measurementBatchSize(1000)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
                 .build();
 
         new Runner(opt).run();


[camel-performance-tests] 05/06: Cleanup DirectConcurrentTest

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit 09f75962684c059cb2ca0b1c9add289054ad1c95
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Sat Feb 11 11:18:12 2023 +0100

    Cleanup DirectConcurrentTest
    
    - Increase the iterations for the DirectConcurrentTest
    - Use higher resolution for the DirectConcurrentTest
---
 .../test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
index 66373e8..b5632bb 100644
--- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
@@ -52,9 +52,9 @@ public class DirectConcurrentTest {
                 .include(this.getClass().getName() + ".*")
                 // Set the following options as needed
                 .mode(Mode.AverageTime)
-                .timeUnit(TimeUnit.MILLISECONDS)
+                .timeUnit(TimeUnit.MICROSECONDS)
                 .warmupIterations(1)
-                .measurementIterations(5)
+                .measurementIterations(15)
                 .threads(4)
                 .forks(1)
                 .shouldFailOnError(true)


[camel-performance-tests] 01/06: Added a few simple seda tests to stress the core

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit 8965b1a7561765734f9531a9b5e30b7d3bffa2f3
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Nov 10 10:16:50 2022 +0100

    Added a few simple seda tests to stress the core
---
 .../itest/jmh/BlockingProducerToSedaTest.java      |  80 ++++++++++++++++
 ...ngProducerWithArrayBlockingQueueToSedaTest.java | 102 +++++++++++++++++++++
 .../camel/itest/jmh/ContextStartStopTest.java      |  67 ++++++++++++++
 .../apache/camel/itest/jmh/SedaRoundTripTest.java  |  73 +++++++++++++++
 4 files changed, 322 insertions(+)

diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
new file mode 100644
index 0000000..420c93d
--- /dev/null
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerToSedaTest.java
@@ -0,0 +1,80 @@
+package org.apache.camel.itest.jmh;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.Test;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+public class BlockingProducerToSedaTest {
+
+    @Test
+    public void launchBenchmark() throws Exception {
+        Options opt = new OptionsBuilder()
+                // Specify which benchmarks to run.
+                // You can be more specific if you'd like to run only one benchmark per test.
+                .include(this.getClass().getName() + ".*")
+                // Set the following options as needed
+                .measurementIterations(10)
+                .warmupIterations(5)
+                .forks(1)
+                .build();
+
+        new Runner(opt).run();
+    }
+
+    // The JMH samples are the best documentation for how to use it
+    // http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/
+    @State(Scope.Benchmark)
+    public static class BenchmarkState {
+
+        CamelContext context;
+        ProducerTemplate producerTemplate;
+
+        @Setup(Level.Trial)
+        public void initialize() throws Exception {
+            context = new DefaultCamelContext();
+
+            producerTemplate = context.createProducerTemplate();
+
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() {
+                    onException(IllegalStateException.class)
+                            .process(e -> System.out.println("The SEDA queue is likely full and the system may be unable to catch to the load. Fix the test parameters"));
+
+                    fromF("seda:test").to("log: ${body}");
+
+                }
+            });
+
+            context.start();
+        }
+    }
+
+    @OutputTimeUnit(TimeUnit.MILLISECONDS)
+    @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
+    @Benchmark
+    public void sendBlocking(BlockingProducerToSedaTest.BenchmarkState state, Blackhole bh) {
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", "test");
+    }
+
+
+
+
+
+}
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerWithArrayBlockingQueueToSedaTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerWithArrayBlockingQueueToSedaTest.java
new file mode 100644
index 0000000..3779771
--- /dev/null
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/BlockingProducerWithArrayBlockingQueueToSedaTest.java
@@ -0,0 +1,102 @@
+package org.apache.camel.itest.jmh;
+
+import java.io.File;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.seda.ArrayBlockingQueueFactory;
+import org.apache.camel.component.seda.SedaComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.Test;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+public class BlockingProducerWithArrayBlockingQueueToSedaTest {
+
+    @Test
+    public void launchBenchmark() throws Exception {
+        Options opt = new OptionsBuilder()
+                // Specify which benchmarks to run.
+                // You can be more specific if you'd like to run only one benchmark per test.
+                .include(this.getClass().getName() + ".*")
+                // Set the following options as needed
+                .measurementIterations(10)
+                .warmupIterations(5)
+                .forks(1)
+                .resultFormat(ResultFormatType.JSON)
+                .result(this.getClass().getSimpleName() + ".jmh.json")
+                .build();
+
+        new Runner(opt).run();
+    }
+
+    // The JMH samples are the best documentation for how to use it
+    // http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/
+    @State(Scope.Benchmark)
+    public static class BenchmarkState {
+
+        CamelContext context;
+        ProducerTemplate producerTemplate;
+        Endpoint endpoint;
+
+        File sampleFile = new File("some-file");
+        Integer someInt = Integer.valueOf(1);
+        Long someLong = Long.valueOf(2);
+
+        @Setup(Level.Trial)
+        public void initialize() throws Exception {
+            context = new DefaultCamelContext();
+
+            producerTemplate = context.createProducerTemplate();
+            context.getComponent("seda", SedaComponent.class).setDefaultQueueFactory(new ArrayBlockingQueueFactory());
+            endpoint = context.getEndpoint("seda:test?blockWhenFull=true&offerTimeout=1000");
+
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() {
+                    onException(IllegalStateException.class)
+                            .process(e -> System.out.println("The SEDA queue is likely full and the system may be unable to catch to the load. Fix the test parameters"));
+
+                    fromF("seda:test").to("log:?level=OFF");
+
+                }
+            });
+
+            context.start();
+        }
+    }
+
+    @OutputTimeUnit(TimeUnit.MILLISECONDS)
+    @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
+    @Benchmark
+    public void sendBlocking(BlockingProducerWithArrayBlockingQueueToSedaTest.BenchmarkState state, Blackhole bh) {
+        state.producerTemplate.sendBody(state.endpoint, "test");
+    }
+
+
+    @OutputTimeUnit(TimeUnit.MILLISECONDS)
+    @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
+    @Benchmark
+    public void sendBlockingWithMultipleTypes(BlockingProducerWithArrayBlockingQueueToSedaTest.BenchmarkState state, Blackhole bh) {
+        state.producerTemplate.sendBody(state.endpoint, "test");
+        state.producerTemplate.sendBody(state.endpoint, state.someInt);
+        state.producerTemplate.sendBody(state.endpoint, state.someLong);
+        state.producerTemplate.sendBody(state.endpoint, state.sampleFile);
+    }
+
+
+}
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java
new file mode 100644
index 0000000..a1cbc2d
--- /dev/null
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/ContextStartStopTest.java
@@ -0,0 +1,67 @@
+package org.apache.camel.itest.jmh;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.engine.PrototypeExchangeFactory;
+import org.apache.camel.model.ModelCamelContext;
+import org.junit.jupiter.api.Test;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+public class ContextStartStopTest {
+
+    @Test
+    public void launchBenchmark() throws Exception {
+        Options opt = new OptionsBuilder()
+                // Specify which benchmarks to run.
+                // You can be more specific if you'd like to run only one benchmark per test.
+                .include(this.getClass().getName() + ".*")
+                // Set the following options as needed
+                .mode(Mode.Throughput)
+                .timeUnit(TimeUnit.MICROSECONDS)
+                .measurementIterations(10)
+                .warmupIterations(5)
+                .forks(1)
+                .build();
+
+        new Runner(opt).run();
+    }
+
+    // The JMH samples are the best documentation for how to use it
+    // http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/
+    @State(Scope.Benchmark)
+    public static class BenchmarkState {
+
+        CamelContext context;
+        PrototypeExchangeFactory factory;
+        ExtendedCamelContext extendedCamelContext;
+        ModelCamelContext modelCamelContext;
+
+        @Setup(Level.Trial)
+        public void initialize() {
+            context = new DefaultCamelContext();
+        }
+    }
+
+
+    @Benchmark
+    public void contextCycle(ContextStartStopTest.BenchmarkState state, Blackhole bh) {
+        state.context.start();
+        state.context.stop();
+
+        bh.consume(state.context);
+    }
+
+
+}
diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
new file mode 100644
index 0000000..0e945ac
--- /dev/null
+++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SedaRoundTripTest.java
@@ -0,0 +1,73 @@
+package org.apache.camel.itest.jmh;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.Test;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+public class SedaRoundTripTest {
+
+    @Test
+    public void launchBenchmark() throws Exception {
+        Options opt = new OptionsBuilder()
+                // Specify which benchmarks to run.
+                // You can be more specific if you'd like to run only one benchmark per test.
+                .include(this.getClass().getName() + ".*")
+                // Set the following options as needed
+                .measurementIterations(10)
+                .warmupIterations(5)
+                .forks(1)
+                .build();
+
+        new Runner(opt).run();
+    }
+
+    // The JMH samples are the best documentation for how to use it
+    // http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/
+    @State(Scope.Benchmark)
+    public static class BenchmarkState {
+
+        CamelContext context;
+        ProducerTemplate producerTemplate;
+        ConsumerTemplate consumerTemplate;
+
+        @Setup(Level.Trial)
+        public void initialize() throws Exception {
+            context = new DefaultCamelContext();
+
+            producerTemplate = context.createProducerTemplate();
+            consumerTemplate = context.createConsumerTemplate();
+
+            context.start();
+        }
+    }
+
+    @OutputTimeUnit(TimeUnit.MILLISECONDS)
+    @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SingleShotTime})
+    @Benchmark
+    public void sendBlocking(SedaRoundTripTest.BenchmarkState state, Blackhole bh) {
+        state.producerTemplate.sendBody("seda:test?blockWhenFull=true&offerTimeout=1000", "test");
+        bh.consume(state.consumerTemplate.receive("seda:test"));
+    }
+
+
+
+
+
+}


[camel-performance-tests] 02/06: (chores): increase timeout duration to avoid problems with long-running tests

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit 197d677edf14f5200ad7e065869365a33735f161
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Nov 11 12:40:01 2022 +0100

    (chores): increase timeout duration to avoid problems with long-running tests
---
 pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pom.xml b/pom.xml
index 836e68c..d6cb6b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -142,6 +142,7 @@
                 <configuration>
                     <forkCount>1</forkCount>
                     <reuseForks>false</reuseForks>
+                    <forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>
                     <systemPropertyVariables>
                         <skipStartingCamelContext>${skip.starting.camel.context}</skipStartingCamelContext>
                     </systemPropertyVariables>