SlideShare a Scribd company logo
1 of 27
Helidon Níma – Loom based
microservices framework
About Myself
2
Dmitry Kornilov
Director of Software Development at Oracle
Email: dmitry.kornilov@oracle.com
Twitter: @m0mus
Helidon
● Java framework for developing cloud-native microservices
● Open source, licenced under Apache 2.0
○ https://github.com/helidon-io/helidon
● Small and fast
● Minimum number of third-party dependencies
● Supports GraalVM native-image
● https://helidon.io
3
Helidon Packaging
● Executable hollow jar
● JLink image
● GraalVM native image
4
Helidon Flavors
Helidon SE
● Reactive, non-blocking
● Functional style APIs
● Build on top of Netty
5
Helidon MP
● MicroProfile & Jakarta EE
● Imperative APIs
● Annotations &
Dependency Injection
Short History
2018 2020 2022 2023
Helidon 0.x – 1.x
• Java 8
• MicroProfile 3.2
Helidon 2.x
• Java 11
• MicroProfile 3.3
Helidon 3.x
• Java 17
• MicroProfile 5.0
Helidon 4.x
• Java 19 (Java 21)
• MicroProfile.next
Our Goal - Efficiency & Performance
● Faster requests processing
● Use less CPU cycles
● Use less memory
● Minimize disk footprint
7
Problems
● One thread per request model is limited
● User threads are mapped 1:1 to kernel threads
● Kernel threads are scheduled by the OS
● Creating a kernel thread is an expensive operation
8
Solution 1 - Reactive Programming
● Asynchronous - we don’t wait for something to happen
● Callback functions - called when it happens
● Back pressure
○ Resistance or force opposing the desired flow of fluid through pipes data through software.
● Reactive Streams Specification
○ https://www.reactive-streams.org/
○ Reactive Streams is an initiative to provide a standard for asynchronous stream processing with
non-blocking back pressure
○ Java implements it since version 9 with Flow API
9
Helidon SE – Our Solution
● Reactive, Non-blocking
● Uses event loop (small number of threads to process all requests)
● MicroProfile Reactive Streams Operators
● MicroProfile Reactive Messaging
● Reactive WebServer
● Reactive WebClient
● Reactive DBClient
10
Problems of Reactive Programming
● Steep learning curve
● Callback hell
● Code is difficult to read
● Code is difficult to debug
● Code is difficult to test
11
Sample – Helidon SE
private void parallel(ServerRequest req, ServerResponse res) {
int count = count(req);
Multi.range(0, count)
.flatMap(i -> Single.create(CompletableFuture.supplyAsync(() -> {
return client().get().request(String.class);
}, EXECUTOR))
.flatMap(Function.identity()))
.collectList()
.map(it -> "Combined results: " + it)
.onError(res::send)
.forSingle(res::send);
}
Solution 2 – Java Virtual Threads
● Project Loom (JEP-425)
● Available as preview in Java 19
● Threads can now be either Platform or Virtual
● Virtual threads are mapped M:N to platform threads
● Blocking operations on virtual threads
do not block platform threads
● Virtual threads are cheap to create
● Virtual threads are cheap to block
13
Helidon Níma – Our Solution
● The first microservices framework based on virtual threads
● Scalability of asynchronous programming models with the simplicity of
synchronous code
● Built from the ground up in tight collaboration with the Java team
● Contains Níma web server plus additional goodies
● Will be released as part of Helidon 4.0 next year
● ALPHA2 is released
● https://helidon.io/nima
14
Sample - Níma
private void parallel(ServerRequest req, ServerResponse res) throws Exception {
try (var exec = Executors.newVirtualThreadPerTaskExecutor()) {
int count = count(req);
var futures = new ArrayList<Future<String>>();
for (int i = 0; i < count; i++) {
futures.add(exec.submit(() -> callRemote(client)));
}
var responses = new ArrayList<String>();
for (var future : futures) {
responses.add(future.get());
}
res.send("Combined results: " + responses);
}
}
Helidon Níma thread model
16
● Socket listeners are platform threads (one per port)
● HTTP/1.1 uses two virtual threads per connection
(can be configured to use just one)
● HTTP/2 uses two virtual threads per connection, and one virtual thread per
stream
● All routes are executed within a virtual thread, and can block as needed
Performance Disclaimer
● Single Linux machine used for client and server (loopback)
○ Intel Core i9–9900K @ 3.6 GHz x 16
○ 32 GiB memory
○ Ubuntu Linux
● Different Java versions used (as Níma requires 19)
● Used code from TechEmpower benchmark (not the benchmark itself)
● Versions:
○ Netty 4.1.36 pure handler (no higher-level framework)
○ Helidon SE 2.5.1 reactive routing
○ Helidon Níma 4.0.0-ALPHA2 blocking routing
Performance
18
0
500000
1000000
1500000
2000000
2500000
3000000
3500000
4000000
4500000
plaintext JSON
Nima Netty
Helidon Níma Server (ALPHA2) – Features
● HTTP/1.1 with pipelining
○ Server and Client
● HTTP/2 prototype, either h2c or h2 (upgrade/ALPN)
○ Server, Client in progress
● GRPC prototype
○ Server, Client TBD
● WebSocket Server prototype
● Extensible to other TCP protocols
● Testing support
○ Unit and integration tests
19
Helidon Níma – Features
● Access Log
● CORS support
● Static Content
● Tracing – Open Telemetry & OpenTracing
● Health checks
2
0
Helidon Flavors (next major release)
Helidon SE
● Reactive, non-blocking
● Functional style APIs
● Build on top of Netty
21
Helidon MP
● MicroProfile & Jakarta EE
● Java EE style APIs
● Annotations &
Dependency Injection
Helidon Níma
● Blocking
● Based on virtual threads
● Easy to use, test and
debug
Performance
2
2
0
50,000
100,000
150,000
200,000
250,000
JSON
MP (Nima) MP
Demo
https://github.com/tomas-langer/helidon-nima-example
Challenges (1/2)
● Re-use or not re-use (byte buffers/byte arrays)
○ Due to the huge number of virtual threads, using a single component to cache
buffers for re-use is not efficient. We have achieved higher throughput with
discarding them (and let GC do its work) than with reuse. Similar results with native
byte buffers and heap byte buffers
● Asynchronous writes
○ By default, we write to sockets asynchronously. On Linux, this provides higher
performance when HTTP/1.1 pipelining is used (up to 3x). When not using
pipelining, there is no additional advantage to this. So, the async writes are
configurable and can be disabled.
2
4
Challenges (2/2)
● Blocking or non-blocking sockets/socket channels
○ After a lot of testing and validation with Java team, we found out that the best
performance is achieved with blocking sockets – e.g., we use ServerSocket in the
blocking mode to listen for connections and “old school” approach of accepting a
socket and running a new virtual thread to process it
● Get used to blocking!
○ If you are used to write a reactive code, it could be difficult to switch to blocking.
You should just block!
2
5
2
6
@helidon_project
https://helidon.io/nima
https://medium.com/helidon
https://github.com/helidon-io
https://youtube.com/Helidon_Project
https://helidon.slack.com
Thank you!
Join the conversation:
@EclipseCon | #EclipseCon

More Related Content

Similar to Helidon Nima - Loom based microserfice framework.pptx

Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kevin Lynch
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornMaxime Najim
 
Open stack HA - Theory to Reality
Open stack HA -  Theory to RealityOpen stack HA -  Theory to Reality
Open stack HA - Theory to RealitySriram Subramanian
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]Leonardo Zanivan
 
Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021Taro L. Saito
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterTim Ellison
 
Deep Dive into Node.js Event Loop.pdf
Deep Dive into Node.js Event Loop.pdfDeep Dive into Node.js Event Loop.pdf
Deep Dive into Node.js Event Loop.pdfShubhamChaurasia88
 
20141111_SOS3_Gallo
20141111_SOS3_Gallo20141111_SOS3_Gallo
20141111_SOS3_GalloAndrea Gallo
 
LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2Linaro
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2aspyker
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenchesJohannes Rudolph
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The BeginningAxilis
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Strata Singapore: GearpumpReal time DAG-Processing with Akka at ScaleStrata Singapore: GearpumpReal time DAG-Processing with Akka at Scale
Strata Singapore: Gearpump Real time DAG-Processing with Akka at ScaleSean Zhong
 
Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Petr Zapletal
 

Similar to Helidon Nima - Loom based microserfice framework.pptx (20)

Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
 
Varnish - PLNOG 4
Varnish - PLNOG 4Varnish - PLNOG 4
Varnish - PLNOG 4
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with Nashorn
 
Full stack development
Full stack developmentFull stack development
Full stack development
 
Open stack HA - Theory to Reality
Open stack HA -  Theory to RealityOpen stack HA -  Theory to Reality
Open stack HA - Theory to Reality
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
 
Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021
 
Monkey Server
Monkey ServerMonkey Server
Monkey Server
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
Deep Dive into Node.js Event Loop.pdf
Deep Dive into Node.js Event Loop.pdfDeep Dive into Node.js Event Loop.pdf
Deep Dive into Node.js Event Loop.pdf
 
Node.js scaling in highload
Node.js scaling in highloadNode.js scaling in highload
Node.js scaling in highload
 
20141111_SOS3_Gallo
20141111_SOS3_Gallo20141111_SOS3_Gallo
20141111_SOS3_Gallo
 
Twisted
TwistedTwisted
Twisted
 
LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenches
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The Beginning
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Strata Singapore: GearpumpReal time DAG-Processing with Akka at ScaleStrata Singapore: GearpumpReal time DAG-Processing with Akka at Scale
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
 
Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018
 

More from Dmitry Kornilov

Jakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowJakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowDmitry Kornilov
 
Building Cloud-Native Applications with Helidon
Building Cloud-Native Applications with HelidonBuilding Cloud-Native Applications with Helidon
Building Cloud-Native Applications with HelidonDmitry Kornilov
 
Nonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SENonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SEDmitry Kornilov
 
JSON Support in Jakarta EE: Present and Future
JSON Support in Jakarta EE: Present and FutureJSON Support in Jakarta EE: Present and Future
JSON Support in Jakarta EE: Present and FutureDmitry Kornilov
 
Building cloud native microservices with project Helidon
Building cloud native microservices with project HelidonBuilding cloud native microservices with project Helidon
Building cloud native microservices with project HelidonDmitry Kornilov
 
Developing cloud-native microservices using project Helidon
Developing cloud-native microservices using project HelidonDeveloping cloud-native microservices using project Helidon
Developing cloud-native microservices using project HelidonDmitry Kornilov
 
From Java EE to Jakarta EE
From Java EE to Jakarta EEFrom Java EE to Jakarta EE
From Java EE to Jakarta EEDmitry Kornilov
 
Helidon: Java Libraries for Writing Microservices
Helidon: Java Libraries for Writing MicroservicesHelidon: Java Libraries for Writing Microservices
Helidon: Java Libraries for Writing MicroservicesDmitry Kornilov
 
JSON Support in Java EE 8
JSON Support in Java EE 8JSON Support in Java EE 8
JSON Support in Java EE 8Dmitry Kornilov
 
Adopt-a-JSR session (JSON-B/P)
Adopt-a-JSR session (JSON-B/P)Adopt-a-JSR session (JSON-B/P)
Adopt-a-JSR session (JSON-B/P)Dmitry Kornilov
 
Configuration for Java EE: Config JSR and Tamaya
Configuration for Java EE: Config JSR and TamayaConfiguration for Java EE: Config JSR and Tamaya
Configuration for Java EE: Config JSR and TamayaDmitry Kornilov
 
JSON Support in Java EE 8
JSON Support in Java EE 8JSON Support in Java EE 8
JSON Support in Java EE 8Dmitry Kornilov
 
Configuration for Java EE and the Cloud
Configuration for Java EE and the CloudConfiguration for Java EE and the Cloud
Configuration for Java EE and the CloudDmitry Kornilov
 
What's new in the Java API for JSON Binding
What's new in the Java API for JSON BindingWhat's new in the Java API for JSON Binding
What's new in the Java API for JSON BindingDmitry Kornilov
 
JSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksJSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksDmitry Kornilov
 
What’s new in JSR 367 Java API for JSON Binding
What’s new in JSR 367 Java API for JSON BindingWhat’s new in JSR 367 Java API for JSON Binding
What’s new in JSR 367 Java API for JSON BindingDmitry Kornilov
 

More from Dmitry Kornilov (19)

Jakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowJakarta EE: Today and Tomorrow
Jakarta EE: Today and Tomorrow
 
Building Cloud-Native Applications with Helidon
Building Cloud-Native Applications with HelidonBuilding Cloud-Native Applications with Helidon
Building Cloud-Native Applications with Helidon
 
Nonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SENonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SE
 
JSON Support in Jakarta EE: Present and Future
JSON Support in Jakarta EE: Present and FutureJSON Support in Jakarta EE: Present and Future
JSON Support in Jakarta EE: Present and Future
 
Building cloud native microservices with project Helidon
Building cloud native microservices with project HelidonBuilding cloud native microservices with project Helidon
Building cloud native microservices with project Helidon
 
Developing cloud-native microservices using project Helidon
Developing cloud-native microservices using project HelidonDeveloping cloud-native microservices using project Helidon
Developing cloud-native microservices using project Helidon
 
From Java EE to Jakarta EE
From Java EE to Jakarta EEFrom Java EE to Jakarta EE
From Java EE to Jakarta EE
 
Helidon: Java Libraries for Writing Microservices
Helidon: Java Libraries for Writing MicroservicesHelidon: Java Libraries for Writing Microservices
Helidon: Java Libraries for Writing Microservices
 
Introduction to Yasson
Introduction to YassonIntroduction to Yasson
Introduction to Yasson
 
JSON Support in Java EE 8
JSON Support in Java EE 8JSON Support in Java EE 8
JSON Support in Java EE 8
 
Adopt-a-JSR session (JSON-B/P)
Adopt-a-JSR session (JSON-B/P)Adopt-a-JSR session (JSON-B/P)
Adopt-a-JSR session (JSON-B/P)
 
Configuration for Java EE: Config JSR and Tamaya
Configuration for Java EE: Config JSR and TamayaConfiguration for Java EE: Config JSR and Tamaya
Configuration for Java EE: Config JSR and Tamaya
 
JSON Support in Java EE 8
JSON Support in Java EE 8JSON Support in Java EE 8
JSON Support in Java EE 8
 
Java EE for the Cloud
Java EE for the CloudJava EE for the Cloud
Java EE for the Cloud
 
Configuration for Java EE and the Cloud
Configuration for Java EE and the CloudConfiguration for Java EE and the Cloud
Configuration for Java EE and the Cloud
 
What's new in the Java API for JSON Binding
What's new in the Java API for JSON BindingWhat's new in the Java API for JSON Binding
What's new in the Java API for JSON Binding
 
JSON-B for CZJUG
JSON-B for CZJUGJSON-B for CZJUG
JSON-B for CZJUG
 
JSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksJSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworks
 
What’s new in JSR 367 Java API for JSON Binding
What’s new in JSR 367 Java API for JSON BindingWhat’s new in JSR 367 Java API for JSON Binding
What’s new in JSR 367 Java API for JSON Binding
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 

Helidon Nima - Loom based microserfice framework.pptx

  • 1. Helidon Níma – Loom based microservices framework
  • 2. About Myself 2 Dmitry Kornilov Director of Software Development at Oracle Email: dmitry.kornilov@oracle.com Twitter: @m0mus
  • 3. Helidon ● Java framework for developing cloud-native microservices ● Open source, licenced under Apache 2.0 ○ https://github.com/helidon-io/helidon ● Small and fast ● Minimum number of third-party dependencies ● Supports GraalVM native-image ● https://helidon.io 3
  • 4. Helidon Packaging ● Executable hollow jar ● JLink image ● GraalVM native image 4
  • 5. Helidon Flavors Helidon SE ● Reactive, non-blocking ● Functional style APIs ● Build on top of Netty 5 Helidon MP ● MicroProfile & Jakarta EE ● Imperative APIs ● Annotations & Dependency Injection
  • 6. Short History 2018 2020 2022 2023 Helidon 0.x – 1.x • Java 8 • MicroProfile 3.2 Helidon 2.x • Java 11 • MicroProfile 3.3 Helidon 3.x • Java 17 • MicroProfile 5.0 Helidon 4.x • Java 19 (Java 21) • MicroProfile.next
  • 7. Our Goal - Efficiency & Performance ● Faster requests processing ● Use less CPU cycles ● Use less memory ● Minimize disk footprint 7
  • 8. Problems ● One thread per request model is limited ● User threads are mapped 1:1 to kernel threads ● Kernel threads are scheduled by the OS ● Creating a kernel thread is an expensive operation 8
  • 9. Solution 1 - Reactive Programming ● Asynchronous - we don’t wait for something to happen ● Callback functions - called when it happens ● Back pressure ○ Resistance or force opposing the desired flow of fluid through pipes data through software. ● Reactive Streams Specification ○ https://www.reactive-streams.org/ ○ Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure ○ Java implements it since version 9 with Flow API 9
  • 10. Helidon SE – Our Solution ● Reactive, Non-blocking ● Uses event loop (small number of threads to process all requests) ● MicroProfile Reactive Streams Operators ● MicroProfile Reactive Messaging ● Reactive WebServer ● Reactive WebClient ● Reactive DBClient 10
  • 11. Problems of Reactive Programming ● Steep learning curve ● Callback hell ● Code is difficult to read ● Code is difficult to debug ● Code is difficult to test 11
  • 12. Sample – Helidon SE private void parallel(ServerRequest req, ServerResponse res) { int count = count(req); Multi.range(0, count) .flatMap(i -> Single.create(CompletableFuture.supplyAsync(() -> { return client().get().request(String.class); }, EXECUTOR)) .flatMap(Function.identity())) .collectList() .map(it -> "Combined results: " + it) .onError(res::send) .forSingle(res::send); }
  • 13. Solution 2 – Java Virtual Threads ● Project Loom (JEP-425) ● Available as preview in Java 19 ● Threads can now be either Platform or Virtual ● Virtual threads are mapped M:N to platform threads ● Blocking operations on virtual threads do not block platform threads ● Virtual threads are cheap to create ● Virtual threads are cheap to block 13
  • 14. Helidon Níma – Our Solution ● The first microservices framework based on virtual threads ● Scalability of asynchronous programming models with the simplicity of synchronous code ● Built from the ground up in tight collaboration with the Java team ● Contains Níma web server plus additional goodies ● Will be released as part of Helidon 4.0 next year ● ALPHA2 is released ● https://helidon.io/nima 14
  • 15. Sample - Níma private void parallel(ServerRequest req, ServerResponse res) throws Exception { try (var exec = Executors.newVirtualThreadPerTaskExecutor()) { int count = count(req); var futures = new ArrayList<Future<String>>(); for (int i = 0; i < count; i++) { futures.add(exec.submit(() -> callRemote(client))); } var responses = new ArrayList<String>(); for (var future : futures) { responses.add(future.get()); } res.send("Combined results: " + responses); } }
  • 16. Helidon Níma thread model 16 ● Socket listeners are platform threads (one per port) ● HTTP/1.1 uses two virtual threads per connection (can be configured to use just one) ● HTTP/2 uses two virtual threads per connection, and one virtual thread per stream ● All routes are executed within a virtual thread, and can block as needed
  • 17. Performance Disclaimer ● Single Linux machine used for client and server (loopback) ○ Intel Core i9–9900K @ 3.6 GHz x 16 ○ 32 GiB memory ○ Ubuntu Linux ● Different Java versions used (as Níma requires 19) ● Used code from TechEmpower benchmark (not the benchmark itself) ● Versions: ○ Netty 4.1.36 pure handler (no higher-level framework) ○ Helidon SE 2.5.1 reactive routing ○ Helidon Níma 4.0.0-ALPHA2 blocking routing
  • 19. Helidon Níma Server (ALPHA2) – Features ● HTTP/1.1 with pipelining ○ Server and Client ● HTTP/2 prototype, either h2c or h2 (upgrade/ALPN) ○ Server, Client in progress ● GRPC prototype ○ Server, Client TBD ● WebSocket Server prototype ● Extensible to other TCP protocols ● Testing support ○ Unit and integration tests 19
  • 20. Helidon Níma – Features ● Access Log ● CORS support ● Static Content ● Tracing – Open Telemetry & OpenTracing ● Health checks 2 0
  • 21. Helidon Flavors (next major release) Helidon SE ● Reactive, non-blocking ● Functional style APIs ● Build on top of Netty 21 Helidon MP ● MicroProfile & Jakarta EE ● Java EE style APIs ● Annotations & Dependency Injection Helidon Níma ● Blocking ● Based on virtual threads ● Easy to use, test and debug
  • 24. Challenges (1/2) ● Re-use or not re-use (byte buffers/byte arrays) ○ Due to the huge number of virtual threads, using a single component to cache buffers for re-use is not efficient. We have achieved higher throughput with discarding them (and let GC do its work) than with reuse. Similar results with native byte buffers and heap byte buffers ● Asynchronous writes ○ By default, we write to sockets asynchronously. On Linux, this provides higher performance when HTTP/1.1 pipelining is used (up to 3x). When not using pipelining, there is no additional advantage to this. So, the async writes are configurable and can be disabled. 2 4
  • 25. Challenges (2/2) ● Blocking or non-blocking sockets/socket channels ○ After a lot of testing and validation with Java team, we found out that the best performance is achieved with blocking sockets – e.g., we use ServerSocket in the blocking mode to listen for connections and “old school” approach of accepting a socket and running a new virtual thread to process it ● Get used to blocking! ○ If you are used to write a reactive code, it could be difficult to switch to blocking. You should just block! 2 5
  • 27. Thank you! Join the conversation: @EclipseCon | #EclipseCon

Editor's Notes

  1. Liquid dynamics
  2. ForkJoinPool