-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Daniel Kec <[email protected]>
- Loading branch information
Showing
13 changed files
with
369 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Maven | ||
target/ | ||
.m2/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# IntelliJ Idea | ||
.idea/* | ||
!.idea/runConfigurations | ||
*.iws | ||
*.ipr | ||
*.iml | ||
*.releaseBackup | ||
atlassian-ide-plugin.xml | ||
|
||
# Netbeans | ||
nbactions.xml | ||
nb-configuration.xml | ||
|
||
# Eclipse | ||
.settings | ||
.settings/ | ||
.project | ||
.classpath | ||
.factorypath | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# | ||
# Copyright (c) 2024 Oracle and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
FROM container-registry.oracle.com/os/oraclelinux:9-slim as olinux-leyden | ||
|
||
WORKDIR /usr/share | ||
|
||
ARG CHECKPOINT_DIR | ||
|
||
ENV JDK_NAME=openjdk-24-leyden+2-8_linux-x64 | ||
ENV JAVA_HOME=/usr/share/$JDK_NAME | ||
ENV CR_DIR=${CONT_IMG_VER:-/leyden-checkpoint/cr} | ||
|
||
# Install wrk | ||
RUN microdnf -h | ||
RUN microdnf -y update && microdnf -y install perl wget tar gzip curl git openssl-devel | ||
RUN git clone https://github.com/wg/wrk.git && cd wrk && make && cp wrk /usr/local/bin/ | ||
|
||
# Install Leyden | ||
RUN wget -O leyden-jdk.tar.gz "https://download.java.net/java/early_access/leyden/2/${JDK_NAME}_bin.tar.gz" | ||
RUN tar -xvf ./leyden-jdk.tar.gz -C /usr/share && mv /usr/share/jdk-24 $JAVA_HOME | ||
RUN ln -s $JAVA_HOME/bin/jcmd /bin/ && ln -s $JAVA_HOME/bin/jps /bin/ && ln -s $JAVA_HOME/bin/java /bin/ | ||
|
||
FROM olinux-leyden | ||
WORKDIR /helidon | ||
|
||
ADD target/leyden-quickstart.jar . | ||
ADD target/libs ./libs | ||
ADD runtimeLeyden.sh . | ||
ADD warmUp.sh . | ||
ADD measure.sh . | ||
RUN chmod +x ./*.sh | ||
|
||
RUN ./runtimeLeyden.sh | ||
|
||
CMD ["sh","/helidon/runtimeLeyden.sh"] | ||
|
||
EXPOSE 7001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
```bash | ||
mvn clean package | ||
docker build -t leyden-helloworld . -f Dockerfile.leyden | ||
# First time ran, checkpoint is created, stop with Ctrl-C | ||
docker run --privileged --network host --name leyden-helloworld leyden-helloworld | ||
# Second time starting from checkpoint, stop with Ctrl-C | ||
docker start -i leyden-helloworld | ||
``` | ||
|
||
|
||
``` | ||
---- Vanilla | ||
1667 milliseconds (since JVM startup) | ||
Measuring ...Running 10s test @ http://localhost:7001 | ||
16 threads and 16 connections | ||
Thread Stats Avg Stdev Max +/- Stdev | ||
Latency 622.78us 1.37ms 27.81ms 92.19% | ||
Req/Sec 4.09k 2.06k 8.96k 61.38% | ||
651144 requests in 10.02s, 85.07MB read | ||
Requests/sec: 64978.74 | ||
Transfer/sec: 8.49MB | ||
---- Leyden | ||
578 milliseconds (since JVM startup) | ||
Measuring ...Running 10s test @ http://localhost:7001 | ||
16 threads and 16 connections | ||
Thread Stats Avg Stdev Max +/- Stdev | ||
Latency 446.13us 0.86ms 22.79ms 92.21% | ||
Req/Sec 4.57k 1.30k 8.82k 70.10% | ||
729398 requests in 10.10s, 95.30MB read | ||
Requests/sec: 72211.76 | ||
Transfer/sec: 9.43MB | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash -e | ||
|
||
# | ||
# Copyright (c) 2024 Oracle and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
|
||
echo "==== Creating Leyden checkpoint ====" | ||
echo "=== Pre-starting Helidon MP app ===" | ||
set +e | ||
mkdir -p "/leyden-checkpoint/cr" | ||
./warmUp.sh & | ||
$JAVA_HOME/bin/java -XX:CacheDataStore=$CR_DIR/checkpoint.cds -Xlog:cds=debug:file=$CR_DIR/cds.log -jar ./*.jar | ||
set -e | ||
|
||
echo "=== Leyden checkpoint created ===" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
# | ||
# Copyright (c) 2024 Oracle and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
curl --retry 10 --retry-all-errors --retry-delay 1 http://localhost:7001 | ||
printf "\nMeasuring ..." | ||
wrk -c 16 -t 16 -d 10s http://localhost:7001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.helidon.applications</groupId> | ||
<artifactId>helidon-mp</artifactId> | ||
<version>4.1.1</version> | ||
<relativePath/> | ||
</parent> | ||
<groupId>io.helidon.quickstart</groupId> | ||
<artifactId>leyden-quickstart</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.bundles</groupId> | ||
<artifactId>helidon-microprofile-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.openapi</groupId> | ||
<artifactId>helidon-microprofile-openapi</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.health</groupId> | ||
<artifactId>helidon-microprofile-health</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.json.bind</groupId> | ||
<artifactId>jakarta.json.bind-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.jersey.media</groupId> | ||
<artifactId>jersey-media-json-binding</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.logging</groupId> | ||
<artifactId>helidon-logging-jul</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye</groupId> | ||
<artifactId>jandex</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.microprofile.metrics</groupId> | ||
<artifactId>microprofile-metrics-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.metrics</groupId> | ||
<artifactId>helidon-microprofile-metrics</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-libs</id> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.smallrye</groupId> | ||
<artifactId>jandex-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>make-index</id> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash -e | ||
|
||
# | ||
# Copyright (c) 2022-2024 Oracle and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
if [ ! -d "$CR_DIR" ]; | ||
then | ||
echo "==== Creating Leyden checkpoint ====" | ||
echo "=== Pre-starting Helidon MP app ===" | ||
set +e | ||
mkdir -p "$CR_DIR" | ||
./warmUp.sh & | ||
$JAVA_HOME/bin/java -XX:CacheDataStore=$CR_DIR/checkpoint.cds -Xlog:cds=debug:file=$CR_DIR/cds.log -jar ./*.jar | ||
set -e | ||
|
||
echo "=== Leyden checkpoint created ===" | ||
else | ||
echo "==== Starting directly from Leyden checkpoint ====" | ||
#exec ls -l /helidon | ||
./measure.sh & | ||
exec $JAVA_HOME/bin/java -XX:CacheDataStore=$CR_DIR/checkpoint.cds -jar ./*.jar | ||
#exec $JAVA_HOME/bin/java -jar ./*.jar | ||
fi | ||
|
||
|
19 changes: 19 additions & 0 deletions
19
tests/functional/leyden-quickstart/src/main/java/io/helidon/quickstart/HelloResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.helidon.quickstart; | ||
|
||
import jakarta.enterprise.context.RequestScoped; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("/") | ||
@RequestScoped | ||
public class HelloResource { | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String message() { | ||
return "Hello World"; | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
tests/functional/leyden-quickstart/src/main/resources/META-INF/beans.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee | ||
https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd" | ||
version="4.0" | ||
bean-discovery-mode="annotated"> | ||
</beans> |
4 changes: 4 additions & 0 deletions
4
...s/functional/leyden-quickstart/src/main/resources/META-INF/microprofile-config.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
server.port=7001 | ||
server.host=0.0.0.0 | ||
|
||
|
20 changes: 20 additions & 0 deletions
20
tests/functional/leyden-quickstart/src/main/resources/logging.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# Example Logging Configuration File | ||
# For more information see $JAVA_HOME/jre/lib/logging.properties | ||
|
||
# Send messages to the console | ||
handlers=io.helidon.logging.jul.HelidonConsoleHandler | ||
|
||
# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread | ||
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n | ||
|
||
# Global logging level. Can be overridden by specific loggers | ||
.level=INFO | ||
|
||
# Quiet Weld | ||
org.jboss.level=WARNING | ||
|
||
# Component specific log levels | ||
#io.helidon.config.level=INFO | ||
#io.helidon.security.level=INFO | ||
#io.helidon.common.level=INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash -e | ||
|
||
# | ||
# Copyright (c) 2024 Oracle and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
|
||
curl --retry 10 --retry-all-errors --retry-delay 1 http://localhost:7001 | ||
printf "\n==== Warming up ...\n" | ||
wrk -c 16 -t 16 -d 10s http://localhost:7001 | ||
printf "\n==== Warmup complete\n" | ||
kill $(jps | grep jar | awk '{print $1}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters