Skip to content

Commit

Permalink
Merge pull request LesnyRumcajs#139 from brunoborges/fix-other-jvm-ex…
Browse files Browse the repository at this point in the history
…ecutors

Use same executor service (workStealing) for Kotlin and Micronaut
  • Loading branch information
LesnyRumcajs authored May 12, 2021
2 parents f3b767e + 2bea403 commit f8817df
Show file tree
Hide file tree
Showing 41 changed files with 635 additions and 263 deletions.
4 changes: 2 additions & 2 deletions java_aot_bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ghcr.io/graalvm/graalvm-ce:ol8-java11-19.3.5 as rel
FROM ghcr.io/graalvm/graalvm-ce:ol8-java11-21.1.0 as rel

WORKDIR /app
COPY java_micronaut_bench /app
COPY java_aot_bench /app
COPY proto/helloworld/helloworld.proto /app/src/main/proto/helloworld.proto

RUN /app/gradlew assemble
Expand Down
103 changes: 26 additions & 77 deletions java_aot_bench/build.gradle
Original file line number Diff line number Diff line change
@@ -1,109 +1,58 @@
plugins {
id "com.github.johnrengelman.shadow" version "5.2.0"
id "net.ltgt.apt-eclipse" version "0.18"
id "net.ltgt.apt-idea" version "0.18"
// tag::plugin[]
id 'com.google.protobuf' version '0.8.12'
// end::plugin[]
id "application"
id "java"
id("com.github.johnrengelman.shadow") version "7.0.0"
id("io.micronaut.application") version "1.5.0"
id("com.google.protobuf") version "0.8.15"
}

version "0.1"
group "helloworld"


version = "0.1"
group = "com.example"

repositories {
mavenLocal()
jcenter()
}

ext {
micronautVersion = "2.3.3"
micronautGrpcVersion = "2.3.3"
mavenCentral()
}

configurations {
all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
String group = details.requested.group
if(group == 'io.micronaut.grpc') {
details.useVersion(micronautGrpcVersion)
}
}
micronaut {
testRuntime("junit5")
processing {
incremental(true)
annotations("com.example.*")
}
}

dependencies {
annotationProcessor(platform("io.micronaut:micronaut-bom:$micronautVersion"))
testAnnotationProcessor(platform("io.micronaut:micronaut-bom:$micronautVersion"))
implementation(platform("io.micronaut:micronaut-bom:$micronautVersion"))

annotationProcessor("io.micronaut:micronaut-inject-java")
annotationProcessor("io.micronaut:micronaut-validation")

compileOnly "io.micronaut:micronaut-inject-java"
implementation "io.micronaut:micronaut-inject"
implementation "io.micronaut:micronaut-validation"
implementation "io.micronaut:micronaut-runtime"

implementation "io.micronaut.grpc:micronaut-grpc-runtime"

implementation "io.micronaut:micronaut-discovery-client"
runtimeOnly "ch.qos.logback:logback-classic:1.2.3"

testAnnotationProcessor "io.micronaut:micronaut-inject-java"
testAnnotationProcessor "io.micronaut:micronaut-validation"

testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation 'io.micronaut.test:micronaut-test-junit5'
testImplementation "org.mockito:mockito-junit-jupiter:2.22.0"
testImplementation "io.micronaut:micronaut-inject-java"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"

compileOnly("org.graalvm.nativeimage:svm")
annotationProcessor("io.micronaut:micronaut-graal")
}

test {
useJUnitPlatform()
}

shadowJar {
mergeServiceFiles()
implementation("io.micronaut:micronaut-runtime")
implementation("io.micronaut.grpc:micronaut-grpc-runtime")
implementation("javax.annotation:javax.annotation-api")
runtimeOnly("ch.qos.logback:logback-classic")
implementation("io.micronaut:micronaut-validation")
testImplementation("io.micronaut:micronaut-http-client")
}

run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1')

mainClassName = "helloworld.Application"
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
application {
mainClass.set("helloworld.Application")
}

// tag::config[]
ext {
protocVersion="3.12.2"
grpcVersion="1.30.0"
java {
sourceCompatibility = JavaVersion.toVersion("11")
targetCompatibility = JavaVersion.toVersion("11")
}

sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
srcDirs("build/generated/source/proto/main/grpc")
srcDirs("build/generated/source/proto/main/java")
}
}
}

protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
protoc { artifact = "com.google.protobuf:protoc:3.14.0" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
grpc { artifact = "io.grpc:protoc-gen-grpc-java:1.33.1" }
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
// end::config[]
1 change: 1 addition & 0 deletions java_aot_bench/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
micronautVersion=2.5.1
Binary file modified java_aot_bench/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion java_aot_bench/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion java_aot_bench/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
21 changes: 3 additions & 18 deletions java_aot_bench/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,29 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
9 changes: 5 additions & 4 deletions java_aot_bench/micronaut-cli.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
profile: service
defaultPackage: helloworld
---
applicationType: default
defaultPackage: helloworld
testFramework: junit
sourceLanguage: java
sourceLanguage: java
buildTool: gradle
features: [annotation-api, app-name, graalvm, gradle, http-client, java, java-application, junit, logback, netty-server, readme, shade, yaml]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Args = -H:Name=hello-world-java \
-H:Class=helloworld.Application
5 changes: 3 additions & 2 deletions java_micronaut_bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM adoptopenjdk:14.0.2_8-jre-hotspot-bionic
FROM adoptopenjdk:16_36-jdk-hotspot

WORKDIR /app
COPY java_micronaut_bench /app
COPY proto/helloworld/helloworld.proto /app/src/main/proto/helloworld.proto

RUN /app/gradlew installDist

ENV JAVA_OPTS "-XX:MinRAMPercentage=70 -XX:MaxRAMPercentage=70"
ENV GC "-XX:+UseParallelGC"
ENV JAVA_OPTS "${GC} -XX:MinRAMPercentage=70 -XX:MaxRAMPercentage=70"

ENTRYPOINT ["/app/build/install/app/bin/app"]

100 changes: 26 additions & 74 deletions java_micronaut_bench/build.gradle
Original file line number Diff line number Diff line change
@@ -1,106 +1,58 @@
plugins {
id "com.github.johnrengelman.shadow" version "5.2.0"
id "net.ltgt.apt-eclipse" version "0.18"
id "net.ltgt.apt-idea" version "0.18"
// tag::plugin[]
id 'com.google.protobuf' version '0.8.12'
// end::plugin[]
id "application"
id "java"
id("com.github.johnrengelman.shadow") version "7.0.0"
id("io.micronaut.application") version "1.5.0"
id("com.google.protobuf") version "0.8.15"
}

version "0.1"
group "helloworld"


version = "0.1"
group = "com.example"

repositories {
mavenLocal()
jcenter()
}

ext {
micronautVersion = "2.0.0.M3"
micronautGrpcVersion = "2.0.0.M3"
mavenCentral()
}

configurations {
all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
String group = details.requested.group
if(group == 'io.micronaut.grpc') {
details.useVersion(micronautGrpcVersion)
}
}
micronaut {
testRuntime("junit5")
processing {
incremental(true)
annotations("com.example.*")
}
}

dependencies {
annotationProcessor(platform("io.micronaut:micronaut-bom:$micronautVersion"))
testAnnotationProcessor(platform("io.micronaut:micronaut-bom:$micronautVersion"))
implementation(platform("io.micronaut:micronaut-bom:$micronautVersion"))

annotationProcessor("io.micronaut:micronaut-inject-java")
annotationProcessor("io.micronaut:micronaut-validation")

compileOnly "io.micronaut:micronaut-inject-java"
implementation "io.micronaut:micronaut-inject"
implementation "io.micronaut:micronaut-validation"
implementation "io.micronaut:micronaut-runtime"

implementation "io.micronaut.grpc:micronaut-grpc-runtime"

implementation "io.micronaut:micronaut-discovery-client"
runtimeOnly "ch.qos.logback:logback-classic:1.2.3"

testAnnotationProcessor "io.micronaut:micronaut-inject-java"
testAnnotationProcessor "io.micronaut:micronaut-validation"

testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation 'io.micronaut.test:micronaut-test-junit5'
testImplementation "org.mockito:mockito-junit-jupiter:2.22.0"
testImplementation "io.micronaut:micronaut-inject-java"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}

test {
useJUnitPlatform()
}

shadowJar {
mergeServiceFiles()
implementation("io.micronaut:micronaut-runtime")
implementation("io.micronaut.grpc:micronaut-grpc-runtime")
implementation("javax.annotation:javax.annotation-api")
runtimeOnly("ch.qos.logback:logback-classic")
implementation("io.micronaut:micronaut-validation")
testImplementation("io.micronaut:micronaut-http-client")
}

run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1')

mainClassName = "helloworld.Application"
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
application {
mainClass.set("helloworld.Application")
}

// tag::config[]
ext {
protocVersion="3.12.2"
grpcVersion="1.30.0"
java {
sourceCompatibility = JavaVersion.toVersion("16")
targetCompatibility = JavaVersion.toVersion("16")
}

sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
srcDirs("build/generated/source/proto/main/grpc")
srcDirs("build/generated/source/proto/main/java")
}
}
}

protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
protoc { artifact = "com.google.protobuf:protoc:3.14.0" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
grpc { artifact = "io.grpc:protoc-gen-grpc-java:1.33.1" }
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
// end::config[]
1 change: 1 addition & 0 deletions java_micronaut_bench/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
micronautVersion=2.5.1
Binary file modified java_micronaut_bench/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion java_micronaut_bench/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
Loading

0 comments on commit f8817df

Please sign in to comment.