Skip to content

Commit dd726ff

Browse files
committed
Use Jetty 11 in performance tool
Because Jetty 9.4 is going out of support. This makes the performance tool require Java 11, but this is acceptable considering its nature (not the Java library itself). This does not change the requirements of the Java client library. The client JAR will not contain the performance tool classes anymore. Fixes #143
1 parent 34204ec commit dd726ff

17 files changed

+65
-12
lines changed

pom.xml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<micrometer.version>1.9.1</micrometer.version>
5858
<swiftmq-client.version>12.2.2</swiftmq-client.version>
5959
<picocli.version>4.6.3</picocli.version>
60-
<jetty.version>9.4.48.v20220622</jetty.version>
60+
<jetty.version>11.0.11</jetty.version>
6161
<guava.version>31.1-jre</guava.version>
6262
<commons-compress.version>1.21</commons-compress.version>
6363
<zstd-jni.version>1.5.2-3</zstd-jni.version>
@@ -189,7 +189,7 @@
189189

190190
<dependency>
191191
<groupId>org.eclipse.jetty</groupId>
192-
<artifactId>jetty-servlet</artifactId>
192+
<artifactId>jetty-server</artifactId>
193193
<version>${jetty.version}</version>
194194
<optional>true</optional>
195195
</dependency>
@@ -578,6 +578,49 @@
578578
</build>
579579

580580
<profiles>
581+
582+
<profile>
583+
<id>perf</id>
584+
<activation>
585+
<jdk>[11,)</jdk>
586+
</activation>
587+
<build>
588+
<plugins>
589+
<plugin>
590+
<groupId>org.codehaus.mojo</groupId>
591+
<artifactId>build-helper-maven-plugin</artifactId>
592+
<version>3.3.0</version>
593+
<executions>
594+
<execution>
595+
<id>add-source</id>
596+
<phase>generate-sources</phase>
597+
<goals>
598+
<goal>add-source</goal>
599+
</goals>
600+
<configuration>
601+
<sources>
602+
<source>src/performance-tool/java</source>
603+
</sources>
604+
</configuration>
605+
</execution>
606+
<execution>
607+
<id>add-test-source</id>
608+
<phase>generate-test-sources</phase>
609+
<goals>
610+
<goal>add-test-source</goal>
611+
</goals>
612+
<configuration>
613+
<sources>
614+
<source>src/performance-tool/test</source>
615+
</sources>
616+
</configuration>
617+
</execution>
618+
</executions>
619+
</plugin>
620+
</plugins>
621+
</build>
622+
</profile>
623+
581624
<profile>
582625
<id>performance-tool</id>
583626
<dependencies>
@@ -621,7 +664,7 @@
621664

622665
<dependency>
623666
<groupId>org.eclipse.jetty</groupId>
624-
<artifactId>jetty-servlet</artifactId>
667+
<artifactId>jetty-server</artifactId>
625668
<version>${jetty.version}</version>
626669
</dependency>
627670

src/docs/asciidoc/performance-tool.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
== The Performance Tool
22

3+
NOTE: The performance tool requires *Java 11 or more*.
4+
35
The library contains also a performance tool to test the RabbitMQ Stream plugin.
46
It is usable as an uber JAR
57
https://github.com/rabbitmq/rabbitmq-stream-java-client/releases[downloadable from GitHub Release] or as a https://hub.docker.com/r/pivotalrabbitmq/stream-perf-test[Docker image].

src/main/java/com/rabbitmq/stream/perf/DebugEndpointMonitoring.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/DebugEndpointMonitoring.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 VMware, Inc. or its affiliates. All rights reserved.
1+
// Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
22
//
33
// This software, the RabbitMQ Stream Java client library, is dual-licensed under the
44
// Mozilla Public License 2.0 ("MPL"), and the Apache License version 2 ("ASL").
@@ -13,6 +13,8 @@
1313
// info@rabbitmq.com.
1414
package com.rabbitmq.stream.perf;
1515

16+
import jakarta.servlet.http.HttpServletRequest;
17+
import jakarta.servlet.http.HttpServletResponse;
1618
import java.io.IOException;
1719
import java.io.PrintWriter;
1820
import java.io.StringWriter;
@@ -26,8 +28,6 @@
2628
import java.util.List;
2729
import java.util.stream.Collectors;
2830
import java.util.stream.Stream;
29-
import javax.servlet.http.HttpServletRequest;
30-
import javax.servlet.http.HttpServletResponse;
3131
import org.eclipse.jetty.server.Request;
3232
import org.eclipse.jetty.server.handler.AbstractHandler;
3333
import picocli.CommandLine.Option;
@@ -54,7 +54,6 @@ public void handle(
5454
HttpServletRequest request,
5555
HttpServletResponse response)
5656
throws IOException {
57-
5857
ThreadInfo[] threadInfos =
5958
ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
6059
String content = formatter.format(threadInfos);

src/main/java/com/rabbitmq/stream/perf/DefaultPerformanceMetrics.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/DefaultPerformanceMetrics.java

File renamed without changes.

src/main/java/com/rabbitmq/stream/perf/LogUtils.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/LogUtils.java

File renamed without changes.

src/main/java/com/rabbitmq/stream/perf/Monitoring.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/Monitoring.java

File renamed without changes.

src/main/java/com/rabbitmq/stream/perf/MonitoringContext.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/MonitoringContext.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@
2626
import org.eclipse.jetty.server.handler.ContextHandler;
2727
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
2828
import org.eclipse.jetty.util.thread.QueuedThreadPool;
29+
import org.slf4j.Logger;
30+
import org.slf4j.LoggerFactory;
2931

3032
class MonitoringContext {
3133

34+
private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringContext.class);
35+
3236
private final int monitoringPort;
3337
private final CompositeMeterRegistry meterRegistry;
3438

@@ -70,14 +74,17 @@ void start() throws Exception {
7074
new ContextHandlerCollection(contextHandlers.toArray(new ContextHandler[0]));
7175
server.setHandler(contextHandler);
7276

73-
server.setStopTimeout(1000);
77+
server.setStopTimeout(10000);
7478
server.start();
7579
}
7680
}
7781

7882
void close() throws Exception {
7983
if (server != null) {
84+
LOGGER.debug("Closing Jetty server");
85+
long start = System.currentTimeMillis();
8086
server.stop();
87+
LOGGER.debug("Closed Jetty server in {} ms", (System.currentTimeMillis() - start));
8188
}
8289
}
8390

src/main/java/com/rabbitmq/stream/perf/PerformanceMetrics.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/PerformanceMetrics.java

File renamed without changes.

src/main/java/com/rabbitmq/stream/perf/PrometheusEndpointMonitoring.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/PrometheusEndpointMonitoring.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 VMware, Inc. or its affiliates. All rights reserved.
1+
// Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
22
//
33
// This software, the RabbitMQ Stream Java client library, is dual-licensed under the
44
// Mozilla Public License 2.0 ("MPL"), and the Apache License version 2 ("ASL").
@@ -15,9 +15,9 @@
1515

1616
import io.micrometer.prometheus.PrometheusConfig;
1717
import io.micrometer.prometheus.PrometheusMeterRegistry;
18+
import jakarta.servlet.http.HttpServletRequest;
19+
import jakarta.servlet.http.HttpServletResponse;
1820
import java.io.IOException;
19-
import javax.servlet.http.HttpServletRequest;
20-
import javax.servlet.http.HttpServletResponse;
2121
import org.eclipse.jetty.server.Request;
2222
import org.eclipse.jetty.server.handler.AbstractHandler;
2323
import picocli.CommandLine.Option;
@@ -47,7 +47,6 @@ public void handle(
4747
HttpServletRequest request,
4848
HttpServletResponse response)
4949
throws IOException {
50-
5150
String scraped = registry.scrape();
5251

5352
response.setStatus(HttpServletResponse.SC_OK);

src/main/java/com/rabbitmq/stream/perf/ShutdownService.java renamed to src/performance-tool/java/com/rabbitmq/stream/perf/ShutdownService.java

File renamed without changes.

0 commit comments

Comments
 (0)