Skip to content

Apache Sling model running on Jetty and unbounded virtual thread based on Early-Access builds of OpenJDK project Loom.

Notifications You must be signed in to change notification settings

tmaret/sling-virtual-thread

Repository files navigation

Sling & Loom

This project runs an Apache Sling instance powered by Jetty configured with an unbounded virtual threads pool. Virtual threads require an early-access builds of the OpenJDK project Loom.

Setup

Setup Project Loom early-access build by following the instructions. Once setup, your java version should look like the following.

$ java -version
openjdk version "16-loom" 2021-03-16
OpenJDK Runtime Environment (build 16-loom+4-56)
OpenJDK 64-Bit Server VM (build 16-loom+4-56, mixed mode, sharing)

Run

Make sure that Apache Maven is available on your setup and if needed install Apache Maven. Clone this project on your local file system, then run the following command

mvn clean install

The slingstart-maven-plugin will take care of starting an author Sling instance on port 9090. The instance is configured with an unbounded pool of virtual threads.

Have a look at the provisioning model files to see what OSGi bundles and configurations are used. The virtual thread pool support is added via a custom build of the Apache Felix org.apache.felix.http.jetty project.

Play

Once your Sling instance is running, you should be able to access it on http://localhost:9090 and play with it.

Request the default page

curl -u admin:admin http://localhost:9090/index.html

Micro benchmark

ab -A admin:admin -c 50 -n 10000 http://localhost:9090/index.html

Monitor threads

Using top monitor the resources used by the server while serving the micro benchmark above. Note how few kernel threads are used to serve at high concurrency level.

top

About

Apache Sling model running on Jetty and unbounded virtual thread based on Early-Access builds of OpenJDK project Loom.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published