SlideShare a Scribd company logo
1 of 14
R2DBC - Good Enough
for Production?
Olexandra Dmytrenko
Experience
• Software Developer
• Work with WebFlux for 6 months
• Java Teacher in KPI
• Kids Programming Teacher
@LadyInIT
Requirements
Many users => thread pools saturation
Microservices
Integration with Akka Streams
New project
Reactive approach
with Spring WebFlux,
event loop concurrency model,
using Netty,
and why not functional
approach?
The Complete flow NoSQL
SQL
WebGateway
Java,
WebFlux
Scala,
Akka
R2DBC
Peculiarities
Reactive non-blocking API for
SQL DBs
Scalable (not one thread per
connection)
Open Specification - driver
vendors can implement and
clients can consume.
R2DBC Support
Reality
R2DBC: Transactions
• SpringData handles "Start Transaction" and "Commit"/"Rollback"
automatically
• You're welcome to write your own (piece of code)
• Working without transactions is faster; do it if you can.
• Because of request and response in different threads, it's hard to
handle @Transactional in Spring
QueryResult queryResult = connectionPool
.inTransaction(conn ->
conn.sendQuery("INSERT INTO Person(NAME)
VALUES('sasha')")).get()
R2DBC and Spring Data
Simple queries like findOne() and saveAll() work well
BUT
@Query("SELECT * FROM USER WHERE USER_ID > :1 AND USER_ID < :2")
Flux<USERS> findByUserId(@Param("userId") Long userId,
@Param("userId") Long userIdSecond);
Is R2DBC better than JDBC?
• Both wait for result to return, even when this is a
List or Flux.
• BUT R2DBC uses NIO with its Event Loop =>
Request is sent and the thread becomes free.
Another thread is called to fetch the result.
Let’s give it a try,
we’re almost in production ;)
Useful Links
http://www.reactive-streams.org/
https://www.reactivemanifesto.org/
https://projectreactor.io/
https://www.thoughtworks.com/radar/languages-and-frameworks/webflux
https://medium.com/netifi/spring-webflux-and-rxjava2-jdbc-83a94e71ba04
https://www.youtube.com/watch?v=9henAE6VUbk
https://github.com/r2dbc/r2dbc-spi/issues/103
https://stackoverflow.com/questions/2625493/asynchronous-vs-non-blocking
@LadyInIT
Async and Non-blocking?
• JDK 9: new class java.util.concurrent.Flow -
Reactive Stream representation, standard for
asynchronous stream processing with non-
blocking back pressure.
• Assynchronous – calls you when is done
• Non-blocking – returns you a promise it will be
done, and you ask, if it’s ready.
• Aimed at runtime environments (JVM and
JavaScript) as well as network protocols.

More Related Content

Similar to R2DBC - Good Enough for Production?

Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)Harald J. Loydl
 
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...Juarez Junior
 
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual ThreadsDWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual ThreadsJuarez Junior
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?Balajihope
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactChen-Tien Tsai
 
Introduction to React Language (1).pptx
Introduction to React Language  (1).pptxIntroduction to React Language  (1).pptx
Introduction to React Language (1).pptxAleksandrosHodo
 
Evolving IGN’s New APIs with Scala
 Evolving IGN’s New APIs with Scala Evolving IGN’s New APIs with Scala
Evolving IGN’s New APIs with ScalaManish Pandit
 
React vs Angular
React vs Angular React vs Angular
React vs Angular Appinventiv
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018Nikolas Burk
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music storeADEEBANADEEM
 
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...Juarez Junior
 
Java keynote preso
Java keynote presoJava keynote preso
Java keynote presoArtur Alves
 
Getting Started with Lightning Web Components | LWC | Salesforce
Getting Started with Lightning Web Components | LWC | SalesforceGetting Started with Lightning Web Components | LWC | Salesforce
Getting Started with Lightning Web Components | LWC | SalesforceRahul Malhotra
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021Soham Dasgupta
 

Similar to R2DBC - Good Enough for Production? (20)

Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)
 
React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
 
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual ThreadsDWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?
 
Oracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node finalOracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node final
 
React Introduction
React IntroductionReact Introduction
React Introduction
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
Introduction to React Language (1).pptx
Introduction to React Language  (1).pptxIntroduction to React Language  (1).pptx
Introduction to React Language (1).pptx
 
NoSQL and ACID
NoSQL and ACIDNoSQL and ACID
NoSQL and ACID
 
Evolving IGN’s New APIs with Scala
 Evolving IGN’s New APIs with Scala Evolving IGN’s New APIs with Scala
Evolving IGN’s New APIs with Scala
 
React vs Angular
React vs Angular React vs Angular
React vs Angular
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music store
 
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
 
Mean stack
Mean stackMean stack
Mean stack
 
Java keynote preso
Java keynote presoJava keynote preso
Java keynote preso
 
Getting Started with Lightning Web Components | LWC | Salesforce
Getting Started with Lightning Web Components | LWC | SalesforceGetting Started with Lightning Web Components | LWC | Salesforce
Getting Started with Lightning Web Components | LWC | Salesforce
 
Spring GraphQL
Spring GraphQLSpring GraphQL
Spring GraphQL
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021
 

More from Olexandra Dmytrenko

More from Olexandra Dmytrenko (9)

Playing programming with kids and bb-8
Playing programming with kids and bb-8Playing programming with kids and bb-8
Playing programming with kids and bb-8
 
Playing Programming with Kids and BB-8
Playing Programming with Kids and BB-8Playing Programming with Kids and BB-8
Playing Programming with Kids and BB-8
 
Память в Java. Garbage Collector
Память в Java. Garbage CollectorПамять в Java. Garbage Collector
Память в Java. Garbage Collector
 
Рекурсия. Поиск
Рекурсия. ПоискРекурсия. Поиск
Рекурсия. Поиск
 
Собеседование на позицию Java Developer
Собеседование на позицию Java DeveloperСобеседование на позицию Java Developer
Собеседование на позицию Java Developer
 
HTML Tables
HTML TablesHTML Tables
HTML Tables
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Discovering Lambdas (Speech)
Discovering Lambdas (Speech)Discovering Lambdas (Speech)
Discovering Lambdas (Speech)
 
itake
itakeitake
itake
 

Recently uploaded

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 

R2DBC - Good Enough for Production?

Editor's Notes

  1. WebFlux is the Spring Framework implementation of Reactive Streams. We see a rise in reactive programming models across our teams in general and the use of WebFlux in teams who are working in the Spring ecosystem. It's best used in large microservices ecosystems where the high performance of the requests is a major concern. It allows overlapping request processing asynchronously without the complications of using multiple threads. WebFlux uses Reactor as its reactive library but it is interoperable with other reactive libraries via Reactive Streams. It uses Netty as its underlying high-performance communications engine. Although we encourage using Reactive Streams, adopting this programming model requires a significant shift in thinking.
  2. Reactive Streams - R2DBC is founded on Reactive Streams providing a fully reactive non-blocking API. Relational Databases - R2DBC engages SQL databases with a reactive API, something not possible with the blocking nature of JDBC. Scalable Solutions - Reactive Streams makes it possible to move from the classic one thread per connection approach to a more powerful, more scalable approach. Open Specification - R2DBC is an open specification establishing a SPI that driver vendors can implement and clients can consume.