$ curl -s "https://get.sdkman.io" | bash
$ sdk i java openjdk-ea-21
$ ./gradlew build
$ java -jar \
--enable-preview \
--add-modules=jdk.incubator.concurrent \
-XX:+UseZGC \
build/libs/openjdk-playground-*-uber.jar
# Virtual thread debugging.
$ jfr print --events jdk.VirtualThreadPinned openjdk-playground.jfr
$ jcmd dev.suresh.Main Thread.dump_to_file -format=json openjdk-playground-threads.json
# Check the incubator modules
$ java --list-modules | grep -i incubator
$ ./gradlew jibDockerBuild
$ docker run -it --rm --name openjdk-playground sureshg/openjdk-playground
-
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