Skip to content

Use Jetty 11 in performance tool #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<micrometer.version>1.9.1</micrometer.version>
<swiftmq-client.version>12.2.2</swiftmq-client.version>
<picocli.version>4.6.3</picocli.version>
<jetty.version>9.4.48.v20220622</jetty.version>
<jetty.version>11.0.11</jetty.version>
<guava.version>31.1-jre</guava.version>
<commons-compress.version>1.21</commons-compress.version>
<zstd-jni.version>1.5.2-3</zstd-jni.version>
Expand Down Expand Up @@ -189,7 +189,7 @@

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
<optional>true</optional>
</dependency>
Expand Down Expand Up @@ -578,6 +578,49 @@
</build>

<profiles>

<profile>
<id>perf</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/performance-tool/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/performance-tool/test</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>performance-tool</id>
<dependencies>
Expand Down Expand Up @@ -621,7 +664,7 @@

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>

Expand Down
2 changes: 2 additions & 0 deletions src/docs/asciidoc/performance-tool.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
== The Performance Tool

NOTE: The performance tool requires *Java 11 or more*.

The library contains also a performance tool to test the RabbitMQ Stream plugin.
It is usable as an uber JAR
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].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 VMware, Inc. or its affiliates. All rights reserved.
// Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
//
// This software, the RabbitMQ Stream Java client library, is dual-licensed under the
// Mozilla Public License 2.0 ("MPL"), and the Apache License version 2 ("ASL").
Expand All @@ -13,6 +13,8 @@
// [email protected].
package com.rabbitmq.stream.perf;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
Expand All @@ -26,8 +28,6 @@
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import picocli.CommandLine.Option;
Expand All @@ -54,7 +54,6 @@ public void handle(
HttpServletRequest request,
HttpServletResponse response)
throws IOException {

ThreadInfo[] threadInfos =
ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
String content = formatter.format(threadInfos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

class MonitoringContext {

private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringContext.class);

private final int monitoringPort;
private final CompositeMeterRegistry meterRegistry;

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

server.setStopTimeout(1000);
server.setStopTimeout(10000);
server.start();
}
}

void close() throws Exception {
if (server != null) {
LOGGER.debug("Closing Jetty server");
long start = System.currentTimeMillis();
server.stop();
LOGGER.debug("Closed Jetty server in {} ms", (System.currentTimeMillis() - start));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 VMware, Inc. or its affiliates. All rights reserved.
// Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
//
// This software, the RabbitMQ Stream Java client library, is dual-licensed under the
// Mozilla Public License 2.0 ("MPL"), and the Apache License version 2 ("ASL").
Expand All @@ -15,9 +15,9 @@

import io.micrometer.prometheus.PrometheusConfig;
import io.micrometer.prometheus.PrometheusMeterRegistry;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import picocli.CommandLine.Option;
Expand Down Expand Up @@ -47,7 +47,6 @@ public void handle(
HttpServletRequest request,
HttpServletResponse response)
throws IOException {

String scraped = registry.scrape();

response.setStatus(HttpServletResponse.SC_OK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.extension.ExtendWith;

@ExtendWith(TestUtils.StreamTestInfrastructureExtension.class)
@EnabledForJreRange(min = JRE.JAVA_11)
public class StreamPerfTestTest {

static ExecutorService executor = Executors.newSingleThreadExecutor();
Expand Down