ebarlas/java-httpserver-vthreads

Native compilation

Closed this issue · 2 comments

I saw https://www.reddit.com/r/java/comments/18vysrr/jdk_http_server_handles_100000_reqsec_with_100_ms/ and since you mentioned 50 MB size of module, a working 19 MB native image can be generated with Gradle configurarion below (plus proper src/main/java location), cheers.

plugins {
    id 'application'
    id 'java'
    id 'org.graalvm.buildtools.native' version '0.9.28'
}

repositories {
    mavenCentral()
}

application {
    mainClass = 'httpsrv.Hello'
}

jar {
    manifest {
        attributes 'Main-Class': application.mainClass
    }
}

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

Thank you Abel and sorry for the delayed response.

This is neat demonstration using Gradle. However, I'd like the demonstrate concepts from first principles. I don't want to add a Gradle dependency.

Would you be willing to add a README section outlining the commands to produce a GraalVM native image?

GraalVM native-image details were added to the README.