Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Apache Sling & OpenJDK Loom - adaptTo 2020

73 views

Published on

Servers ability to serve concurrent requests at higher throughput can reduce the resources footprint and costs of running a service.

This talk reviews approaches to increase Apache Sling throughput and presents practical experiments with a multi-threaded server model backed by OpenJDK project Loom's virtual threads.

Demo code:

https://github.com/tmaret/sling-virtual-thread
https://github.com/tmaret/fibers-server

Published in: Software
  • Be the first to comment

  • Be the first to like this

Apache Sling & OpenJDK Loom - adaptTo 2020

  1. 1. EUROPE'S LEADING AEM DEVELOPER CONFERENCE 28th – 30th SEPTEMBER 2020 Sling & Loom Timothée Maret, Adobe
  2. 2. About the speaker 2 Timothée Maret https://twitter.com/timaret tmaret@apache.org Sr. Software Developer, Tech Lead @ Adobe R&D Apache Sling PMC member
  3. 3. 3 OpenJDK Project Loom
  4. 4. Loom in a nutshell 4 § Add virtual threads support for the JVM § Supports the java.lang.Thread API § Low runtime cost (RAM, scheduling) § Java scheduler pluggable to match specific use cases § Many virtual threads mapped to few kernel threads § Available via Early Access builds https://jdk.java.net/loom Source https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.html
  5. 5. Loom potential 5 § For services with high wait/compute time ratio § Do more with less § Optimize computational resources usage § Increase server throughput § Reduce operating costs § Keep it simple § Synchronous programming § One virtual thread per task § Unbounded or bounded pool
  6. 6. 6 Sling & Loom
  7. 7. Sling is a good use case for Loom 7 § Provides and relies on blocking APIs Resource API, JCR API, etc. § One thread per request and pool model Servlet async processing possible but tricky and limited to few use cases that don’t rely on blocking APIs § High wait/compute workload ratio Request processing requires many repository access
  8. 8. Sling can easily leverage Loom 8 § Keep same technology stack & application code § Minor changes required to the Sling framework § Plug an unbounded virtual thread pool in Jetty via Apache Felix https://github.com/apache/felix-dev/tree/master/http/jetty § Support virtual threads in Sling common threads https://github.com/apache/sling-org-apache-sling-commons-threads § Avoid IO in synchronized blocks
  9. 9. Sling and Loom already play together 9 https://github.com/tmaret/sling-virtual-thread
  10. 10. 10 Benchmark
  11. 11. fibers-server 11 § Jetty based test server https://github.com/tmaret/fibers-server § Configurable workload (wait / compute time) § Configurable threading support § Queued pool of kernel or virtual threads § Unbounded pool of virtual threads
  12. 12. Test setup 12 § 99.5% wait time to compute time ratio § Two deployments § Queue pool with 1000 kernel threads § Unbounded pool of virtual threads § Varies § Avg latency & concurrency
  13. 13. Throughput for 10ms requests 13 Concurrency virtual∶kernel 100 99% 250 104% 500 132% 1000 142% 2000 138% 4000 145% 8000 124% 0 5000 10000 15000 20000 25000 30000 35000 40000 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 Throughput(req/s) Concurrency Level (connections) virtual threads kernel threads
  14. 14. Throughput for 1s requests 14 Concurrency virtual∶kernel 100 101% 250 104% 500 126% 1000 150% 2000 160% 4000 141% 8000 139% 0 50 100 150 200 250 300 350 400 450 500 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 Throughput(req/s) Concurrency Level (connections) virtual threads kernel threads
  15. 15. Kernel threads resources 15 1000x
  16. 16. Virtual threads resources 16 11x
  17. 17. 17 Q & A
  18. 18. References 18 Sling & Loom Demo Apache Sling & unbounded pool of virtual threads https://github.com/tmaret/sling-virtual-thread Eclipse Jetty based test server for virtual threads and benchmark results https://github.com/tmaret/fibers-server Loom OpenJDK wiki, EA builds, status, code, talks https://wiki.openjdk.java.net/display/loom/Main Sling API https://sling.apache.org/apidocs/sling11/index.html

×