Skip to content

Instantly share code, notes, and snippets.

@danielkec
Created November 2, 2023 14:40
Show Gist options
  • Save danielkec/2998c2c3e3908325c2f1d9ea0d483cb2 to your computer and use it in GitHub Desktop.
Save danielkec/2998c2c3e3908325c2f1d9ea0d483cb2 to your computer and use it in GitHub Desktop.
7922-reproducer
FROM container-registry.oracle.com/java/openjdk:21.0.1
ENV VEGETA_VERSION 12.8.4
RUN dnf -y update && dnf -y install wget curl
RUN wget -q "https://github.com/tsenart/vegeta/releases/download/v${VEGETA_VERSION}/vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz" -O /tmp/vegeta.tar.gz \
&& cd /bin \
&& tar xzf /tmp/vegeta.tar.gz \
&& rm /tmp/vegeta.tar.gz
WORKDIR /usr/share
# Install maven
RUN set -x && \
curl -O https://archive.apache.org/dist/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz && \
tar -xvf apache-maven-*-bin.tar.gz && \
rm apache-maven-*-bin.tar.gz && \
mv apache-maven-* maven && \
ln -s /usr/share/maven/bin/mvn /bin/
WORKDIR /
RUN mvn -U archetype:generate -DinteractiveMode=false \
-DarchetypeGroupId=io.helidon.archetypes \
-DarchetypeArtifactId=helidon-quickstart-mp \
-DarchetypeVersion=4.0.0 \
-DgroupId=io.helidon.examples \
-DartifactId=helidon-quickstart-mp \
-Dpackage=io.helidon.examples.quickstart.mp
WORKDIR /helidon-quickstart-mp
RUN cat <<EOT >./src/main/java/io/helidon/examples/quickstart/mp/GreetResource.java
package io.helidon.examples.quickstart.mp;
import java.util.logging.Logger;
import jakarta.enterprise.context.RequestScoped;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
@Path("/greet")
@RequestScoped
public class GreetResource {
@Path("/{name}")
@GET
@Produces(MediaType.APPLICATION_JSON)
public String getMessage(@Context jakarta.ws.rs.core.HttpHeaders headers, @PathParam("name") String name) {
Logger.getLogger(GreetResource.class.getName()).info("test");
return "Hello " + name;
}
}
EOT
RUN mvn clean package -DskipTests
RUN cat <<EOT >/run.sh
#!/bin/bash
for i in {1..100}
do
java -Djdk.tracePinnedThreads=full -jar /helidon-quickstart-mp/target/helidon-quickstart-mp.jar &
echo GET http://localhost:8080/greet/foo | vegeta attack -timeout=30m -rate=500 -duration=1s | vegeta report
killall -9 java
done
EOT
CMD bash /run.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment