$ curl -s "https://get.sdkman.io" | bash
$ sdk i java openjdk-ea-22
$ ./gradlew build
# Lint Github Actions
$ brew install actionlint
$ actionlint
$ java -jar \
--enable-preview \
--add-modules=ALL-SYSTEM \
-XX:+UseZGC -XX:+ZGenerational \
build/libs/openjdk-playground-*-uber.jar
# Show all pinned virtual threads
$ jfr print --events jdk.VirtualThreadPinned openjdk-playground.jfr
# Show all socket events
$ jfr print --stack-depth 100 --events jdk.Socket\* openjdk-playground.jfr
# Virtual thread dump
$ jcmd dev.suresh.Main Thread.dump_to_file -format=json openjdk-playground-threads.json
$ docker run \
-it \
--rm \
--pull always \
--workdir /app \
--publish 8000:8000 \
--name openjdk-playground \
--mount type=bind,source=$(pwd),destination=/app,readonly \
openjdk:22-slim /bin/bash -c "./build/openjdk-playground && printenv && jwebserver -b 0.0.0.0 -p 8000 -d /"
# Download the JFR files
$ wget http://localhost:8000/tmp/openjdk-playground.jfr
# Build the container image
$ ./gradlew jibDockerBuild
$ docker run -it --rm --name openjdk-playground sureshg/openjdk-playground
SBOM and Vulnerability Scan
$ ./gradlew cyclonedxBom
$ osv-scanner --sbom=build/sbom/bom.json
# OR use https://bomdoctor.sonatype.com/
-
Check if the service is up and running!
$ curl -v -k https://localhost:8443
-
Set the os
ulimit
for Vegeta$ ulimit -n 4096 // FD limit $ ulimit -u 1024 // processes limit
-
Run with kernel threads.
$ echo "GET https://127.0.0.1:8443/" | vegeta attack -insecure -duration=10s -name=Threads -rate=250 | tee thread-results.bin | vegeta report $ vegeta report -type=json thread-results.bin > thread-metrics.json $ cat thread-results.bin | vegeta report -type="hist[0,100ms,200ms,300ms]" $ cat thread-results.bin | vegeta plot -title "Normal Threads" > plot.html && open plot.html
-
Run with Virtual threads.
$ echo "GET https://127.0.0.1:8443/" | vegeta attack -insecure -duration=10s -name=VirtualThreads -rate=250 | tee vthread-results.bin | vegeta report $ vegeta report -type=json vthread-results.bin > vthread-metrics.json $ cat vthread-results.bin | vegeta report -type="hist[0,100ms,200ms,300ms]" $ cat vthread-results.bin | vegeta plot -title "Virtual Threads" > plot.html && open plot.html
-
Combine the results and plot a single graph.
$ vegeta plot -title "Threads vs Virtual Threads" vthread-results.bin thread-results.bin > plot.html && open plot.html
Commands
# Check the current version
$ ./gradlew -q --console plain version
# Publish to local repository
$ ./gradlew publishMavenPublicationToLocalRepository
# Stop Gradle and Kotlin daemon
$ ./gradlew --stop && pkill -f KotlinCompileDaemon
# Runs all checks
$ ./gradlew clean check
# Check tasks dependencies
$ ./gradlew clean build --dry-run
# Dep version updates
$ ./gradlew clean dependencyUpdates
# List all available toolchains
$ ./gradlew -q javaToolchains