SlideShare a Scribd company logo
Asynchronous programming
using CompletableFutures
Agenda
• What is asynchronous programming?
• Why should I care?
• How to use CompletableFuture for asynchronous calls?
• Does it worth it?
What is asynchronous
programming?
Latency Numbers
0.5
25
100
0 20 40 60 80 100 120
ns
Main memory reference
Mutex lock/unlock
L1 Cache Reference
Latency Numbers
100
10,000
150,000
0 20000 40000 60000 80000 100000 120000 140000 160000
ns
Read 4K randomly from SSD
Send 1K over 1 Gbps
Main memory reference
Latency Numbers
150,000
250,000
500,000
10,000,0
00
0 2,000,000 4,000,000 6,000,000 8,000,000 10,000,000 12,000,000
ns
Disk seek
Round trip within same
datacenter
Read 1 MB sequentially from
memory
Read 4K randomly from SSD
The Hollywood Principle
Don’t call us,
we’ll call you
Why should I care?
Why should I care?
• Process scheduling in modern kernels is pretty mature
• Re-implementing it in user-space is an anti-pattern
• Java relies on kernel process scheduling
It’s about
• Controlling thread lifecycle
• The Nr. of threads and context switches
• I/O operation optimization
Non blocking I/O
Why should I map number of threads to number of connections?
It doesn’t make sense.
The Selector
Client 1
Client 2
Selector
Handler
Handler
Anatomy of a typical Java application
? ?
Your code goes
here
How to use CompletableFuture
for asynchronous calls?
A Simple Example
Combining Asynchronous Calls
Using Executors Independently
We Have Exception Handling!
Asynchronous programming using CompletableFutures in Java
Tomcat 8
HelloService
Small I/O
Scenario 1
Tomcat 8
HelloService
125ms
Scenario 2
In-memory
Tomcat 8
HelloService
125ms
Scenario 3
Tomcat 8
HelloService
Small I/O
Scenario 4
4 threads
Pros & Cons
Pros
• Combinable executors
• Exception handling
• Fast enough execution
• Java language support
• Easy
Cons
• You have to know what you’re
doing
• Can be blocking
• Can be slower if Executor
scheduling is a bottleneck
Design Considerations
• Blocking 1000 threads because of service failure? Not a smart decision
• Queueing 1000 request-timeouts because of same reasons? Bad idea.
• Bit better choice: less pressure on downstream services
• Choose threading and scheduling mechanism wisely
• ForkJoinPool is most of the time a bad choice
• Monitor and purge request queues in case of a specific failure rate
• Hystrix offers similar mechanism
Questions?
References
GitHub examples
https://github.com/gitaroktato/completablefuture-examples
CPU Scheduling
https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/5_CPU_Scheduling.html
CompletableFuture & Spring Example
https://spring.io/guides/gs/async-method/
Non-blocking IO in Java
https://dnhome.wordpress.com/2012/06/28/java-non-block-io-new-io/
References
CompletableFuture API Examples
https://www.slideshare.net/jpaumard/asynchronous-api-in-java8-how-to-use-completablefuture
Grizzly NIO framework
https://grizzly.java.net/documentation.html
Scalable IO in Java
https://www.slideshare.net/giridhar510/scalable-io-in-java
Non-blocking IO in Java
https://dnhome.wordpress.com/2012/06/28/java-non-block-io-new-io/
RxJava – Multithreading
https://praveer09.github.io/technology/2016/02/29/rxjava-part-3-multithreading/

More Related Content

What's hot (19)

Scaling tappsi
Scaling tappsiScaling tappsi
Scaling tappsi
Óscar Andrés López
 
Rails on JRuby
Rails on JRubyRails on JRuby
Rails on JRuby
Rob C
 
Topaz for Java Performance Webcast
Topaz for Java Performance WebcastTopaz for Java Performance Webcast
Topaz for Java Performance Webcast
Compuware
 
EDB Failover Manager for Seamless Failover & Switchover
EDB Failover Manager for Seamless Failover & SwitchoverEDB Failover Manager for Seamless Failover & Switchover
EDB Failover Manager for Seamless Failover & Switchover
Ashnikbiz
 
CPAN Gems From The Far East
CPAN Gems From The Far EastCPAN Gems From The Far East
CPAN Gems From The Far East
lestrrat
 
High performance in react native
High performance in react nativeHigh performance in react native
High performance in react native
Viet Tran
 
Productivity and scalability with Play and Scala
Productivity and scalability with Play and ScalaProductivity and scalability with Play and Scala
Productivity and scalability with Play and Scala
Christophe Marchal
 
UEMB260: Provisioning: Under the Hood
UEMB260: Provisioning: Under the HoodUEMB260: Provisioning: Under the Hood
UEMB260: Provisioning: Under the Hood
Ivanti
 
Episode 2 conditional flows & loops
Episode 2   conditional flows & loopsEpisode 2   conditional flows & loops
Episode 2 conditional flows & loops
Jitendra Zaa
 
Manage your environment with DSC
Manage your environment with DSCManage your environment with DSC
Manage your environment with DSC
Gian Maria Ricci
 
Zero mq logs
Zero mq logsZero mq logs
Zero mq logs
Tomas Doran
 
Multiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqMultiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mq
ColdFusionConference
 
Enterprise messaging
Enterprise messagingEnterprise messaging
Enterprise messaging
ColdFusionConference
 
Being Agile with Scrum - koders.co
Being Agile with Scrum - koders.coBeing Agile with Scrum - koders.co
Being Agile with Scrum - koders.co
Ender Aydin Orak
 
Erlang at Nu Echo
Erlang at Nu EchoErlang at Nu Echo
Erlang at Nu Echo
Nu Echo Inc.
 
Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.
jhugg
 
Java garbage collection, jvm, visual vm
Java garbage collection, jvm, visual vmJava garbage collection, jvm, visual vm
Java garbage collection, jvm, visual vm
Brad Schoening, MSCS
 
From silex to symfony and viceversa
From silex to symfony and viceversaFrom silex to symfony and viceversa
From silex to symfony and viceversa
Ronny López
 
Squeeze Maximum Performance from your Hosting Platform
Squeeze Maximum Performance from your Hosting PlatformSqueeze Maximum Performance from your Hosting Platform
Squeeze Maximum Performance from your Hosting Platform
SiteGround.com
 
Rails on JRuby
Rails on JRubyRails on JRuby
Rails on JRuby
Rob C
 
Topaz for Java Performance Webcast
Topaz for Java Performance WebcastTopaz for Java Performance Webcast
Topaz for Java Performance Webcast
Compuware
 
EDB Failover Manager for Seamless Failover & Switchover
EDB Failover Manager for Seamless Failover & SwitchoverEDB Failover Manager for Seamless Failover & Switchover
EDB Failover Manager for Seamless Failover & Switchover
Ashnikbiz
 
CPAN Gems From The Far East
CPAN Gems From The Far EastCPAN Gems From The Far East
CPAN Gems From The Far East
lestrrat
 
High performance in react native
High performance in react nativeHigh performance in react native
High performance in react native
Viet Tran
 
Productivity and scalability with Play and Scala
Productivity and scalability with Play and ScalaProductivity and scalability with Play and Scala
Productivity and scalability with Play and Scala
Christophe Marchal
 
UEMB260: Provisioning: Under the Hood
UEMB260: Provisioning: Under the HoodUEMB260: Provisioning: Under the Hood
UEMB260: Provisioning: Under the Hood
Ivanti
 
Episode 2 conditional flows & loops
Episode 2   conditional flows & loopsEpisode 2   conditional flows & loops
Episode 2 conditional flows & loops
Jitendra Zaa
 
Manage your environment with DSC
Manage your environment with DSCManage your environment with DSC
Manage your environment with DSC
Gian Maria Ricci
 
Multiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqMultiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mq
ColdFusionConference
 
Being Agile with Scrum - koders.co
Being Agile with Scrum - koders.coBeing Agile with Scrum - koders.co
Being Agile with Scrum - koders.co
Ender Aydin Orak
 
Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.
jhugg
 
Java garbage collection, jvm, visual vm
Java garbage collection, jvm, visual vmJava garbage collection, jvm, visual vm
Java garbage collection, jvm, visual vm
Brad Schoening, MSCS
 
From silex to symfony and viceversa
From silex to symfony and viceversaFrom silex to symfony and viceversa
From silex to symfony and viceversa
Ronny López
 
Squeeze Maximum Performance from your Hosting Platform
Squeeze Maximum Performance from your Hosting PlatformSqueeze Maximum Performance from your Hosting Platform
Squeeze Maximum Performance from your Hosting Platform
SiteGround.com
 

Similar to Asynchronous programming using CompletableFutures in Java (20)

Need for Async: Hot pursuit for scalable applications
Need for Async: Hot pursuit for scalable applicationsNeed for Async: Hot pursuit for scalable applications
Need for Async: Hot pursuit for scalable applications
Konrad Malawski
 
The Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFuturesThe Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFutures
Haim Yadid
 
Completable future
Completable futureCompletable future
Completable future
Srinivasan Raghvan
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFuture
José Paumard
 
Asynchronous programming with Functional Java and comparison with Scala
Asynchronous programming with Functional Java and comparison with ScalaAsynchronous programming with Functional Java and comparison with Scala
Asynchronous programming with Functional Java and comparison with Scala
Knoldus Inc.
 
The Need for Async @ ScalaWorld
The Need for Async @ ScalaWorldThe Need for Async @ ScalaWorld
The Need for Async @ ScalaWorld
Konrad Malawski
 
Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022
David Gómez García
 
Interactions complicate debugging
Interactions complicate debuggingInteractions complicate debugging
Interactions complicate debugging
Syed Zaid Irshad
 
Asynchronous programming with Java & Spring
Asynchronous programming with Java & SpringAsynchronous programming with Java & Spring
Asynchronous programming with Java & Spring
Ravindra Ranwala
 
Java 8 concurrency abstractions
Java 8 concurrency abstractionsJava 8 concurrency abstractions
Java 8 concurrency abstractions
Nawazish Mohammad Khan
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
 
parallel-asynchronous-programming-java.pptx
parallel-asynchronous-programming-java.pptxparallel-asynchronous-programming-java.pptx
parallel-asynchronous-programming-java.pptx
2022ac05156
 
Asynchronous Programming.pptx
Asynchronous Programming.pptxAsynchronous Programming.pptx
Asynchronous Programming.pptx
Aayush Chimaniya
 
Back to the [Completable] Future
Back to the [Completable] FutureBack to the [Completable] Future
Back to the [Completable] Future
Sofiia Khomyn
 
A first look into the Project Loom in Java
A first look into the Project Loom in JavaA first look into the Project Loom in Java
A first look into the Project Loom in Java
Lukas Steinbrecher
 
Concurrency, Parallelism And IO
Concurrency,  Parallelism And IOConcurrency,  Parallelism And IO
Concurrency, Parallelism And IO
Piyush Katariya
 
Concurrent Programming in Java
Concurrent Programming in JavaConcurrent Programming in Java
Concurrent Programming in Java
Ruben Inoto Soto
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
PROIDEA
 
Leveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyLeveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results Asynchrhonously
David Gómez García
 
Understanding concurrency
Understanding concurrencyUnderstanding concurrency
Understanding concurrency
Anshul Sharma
 
Need for Async: Hot pursuit for scalable applications
Need for Async: Hot pursuit for scalable applicationsNeed for Async: Hot pursuit for scalable applications
Need for Async: Hot pursuit for scalable applications
Konrad Malawski
 
The Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFuturesThe Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFutures
Haim Yadid
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFuture
José Paumard
 
Asynchronous programming with Functional Java and comparison with Scala
Asynchronous programming with Functional Java and comparison with ScalaAsynchronous programming with Functional Java and comparison with Scala
Asynchronous programming with Functional Java and comparison with Scala
Knoldus Inc.
 
The Need for Async @ ScalaWorld
The Need for Async @ ScalaWorldThe Need for Async @ ScalaWorld
The Need for Async @ ScalaWorld
Konrad Malawski
 
Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022
David Gómez García
 
Interactions complicate debugging
Interactions complicate debuggingInteractions complicate debugging
Interactions complicate debugging
Syed Zaid Irshad
 
Asynchronous programming with Java & Spring
Asynchronous programming with Java & SpringAsynchronous programming with Java & Spring
Asynchronous programming with Java & Spring
Ravindra Ranwala
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
 
parallel-asynchronous-programming-java.pptx
parallel-asynchronous-programming-java.pptxparallel-asynchronous-programming-java.pptx
parallel-asynchronous-programming-java.pptx
2022ac05156
 
Asynchronous Programming.pptx
Asynchronous Programming.pptxAsynchronous Programming.pptx
Asynchronous Programming.pptx
Aayush Chimaniya
 
Back to the [Completable] Future
Back to the [Completable] FutureBack to the [Completable] Future
Back to the [Completable] Future
Sofiia Khomyn
 
A first look into the Project Loom in Java
A first look into the Project Loom in JavaA first look into the Project Loom in Java
A first look into the Project Loom in Java
Lukas Steinbrecher
 
Concurrency, Parallelism And IO
Concurrency,  Parallelism And IOConcurrency,  Parallelism And IO
Concurrency, Parallelism And IO
Piyush Katariya
 
Concurrent Programming in Java
Concurrent Programming in JavaConcurrent Programming in Java
Concurrent Programming in Java
Ruben Inoto Soto
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
PROIDEA
 
Leveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyLeveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results Asynchrhonously
David Gómez García
 
Understanding concurrency
Understanding concurrencyUnderstanding concurrency
Understanding concurrency
Anshul Sharma
 
Ad

More from Oresztész Margaritisz (7)

Overview of health-check patterns
Overview of health-check patternsOverview of health-check patterns
Overview of health-check patterns
Oresztész Margaritisz
 
Being agile with modern Java
Being agile with modern JavaBeing agile with modern Java
Being agile with modern Java
Oresztész Margaritisz
 
How to make technical deicisons?
How to make technical deicisons?How to make technical deicisons?
How to make technical deicisons?
Oresztész Margaritisz
 
Cassandra On EPAM Cloud - VDAY 2017
Cassandra On EPAM Cloud - VDAY 2017Cassandra On EPAM Cloud - VDAY 2017
Cassandra On EPAM Cloud - VDAY 2017
Oresztész Margaritisz
 
Cassandra on EPAM Cloud
Cassandra on EPAM CloudCassandra on EPAM Cloud
Cassandra on EPAM Cloud
Oresztész Margaritisz
 
ForkJoinPools and parallel streams
ForkJoinPools and parallel streamsForkJoinPools and parallel streams
ForkJoinPools and parallel streams
Oresztész Margaritisz
 
Introduction to DC/OS
Introduction to DC/OSIntroduction to DC/OS
Introduction to DC/OS
Oresztész Margaritisz
 
Ad

Recently uploaded (20)

June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptxFIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptxFIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptxFIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptxFIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptxFIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptxFIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 

Asynchronous programming using CompletableFutures in Java

Editor's Notes

  • #3: Numbrs every programmer should know Single threaded async programming Async HTTP Proactor vs reactor vs selector
  • #5: Even a simple fetch from memory takes a long time relative to CPU speeds In a simple system running a single process, the time spent waiting for I/O is wasted, and those CPU cycles are lost forever
  • #6: Even a simple fetch from memory takes a long time relative to CPU speeds In a simple system running a single process, the time spent waiting for I/O is wasted, and those CPU cycles are lost forever
  • #7: Even a simple fetch from memory takes a long time relative to CPU speeds In a simple system running a single process, the time spent waiting for I/O is wasted, and those CPU cycles are lost forever
  • #8: Inversion of control Don’t spend polling wait on I/O operation like accept or read
  • #10: The process scheduler schedules only the kernel threads. User threads are mapped to kernel threads by the thread library - The OS ( and in particular the scheduler ) is unaware of them. Virtualization and hardware scheduling are also driving factors
  • #11: The process scheduler schedules only the kernel threads. User threads are mapped to kernel threads by the thread library - The OS ( and in particular the scheduler ) is unaware of them. Virtualization and hardware scheduling are also driving factors
  • #12: concurrent server may be better optimized by aligning its threading strategy to available resources, such as the number of CPUs, rather than to the number of clients is services concurrently
  • #13: It’s worth re-using native support, such as aio_* or select() operation in C
  • #14: Separate application services into asynchronous operations and completion handlers. To implement the Proactor pattern, application services must be designed to separate the initiation of asynchronous operations via a handle from the processing of these operations' results. Asynchronous operations are often long-duration and/or concerned with I/O, such as reading and writing data via a socket handle or communicating with a database. The results of asynchronous operations are processed by completion handlers. In addition to processing results, completion handlers can play the role of initiators, that is, they invoke asynchronous operations Themselves Reactor Select() is not multi-threaded Handler table has perf issues when too big Proactor aio_* libraries
  • #15: It’s worth re-using native support, such as aio_* or select() operation in C
  • #20: Bulkheads!
  • #27: Polling IO in many threads causes increasrd nr of context switches