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

What's hot

Deployment Methodology
Deployment MethodologyDeployment Methodology
Deployment Methodology
David Messineo
 
Implementing PMO
Implementing PMOImplementing PMO
Implementing PMO
TURKI , PMP
 

What's hot (20)

Lean & Agile Project Management
Lean & Agile Project ManagementLean & Agile Project Management
Lean & Agile Project Management
 
The Evolution of Airbnb's Frontend
The Evolution of Airbnb's FrontendThe Evolution of Airbnb's Frontend
The Evolution of Airbnb's Frontend
 
Pmbok 4th edition chapter 6 - Project Time Management
Pmbok 4th edition   chapter 6 - Project Time Management Pmbok 4th edition   chapter 6 - Project Time Management
Pmbok 4th edition chapter 6 - Project Time Management
 
Project Quality Management
Project Quality ManagementProject Quality Management
Project Quality Management
 
Managing the People Side of Change
Managing the People Side of ChangeManaging the People Side of Change
Managing the People Side of Change
 
Detailed Project Status Report Template
Detailed Project Status Report TemplateDetailed Project Status Report Template
Detailed Project Status Report Template
 
Deployment Methodology
Deployment MethodologyDeployment Methodology
Deployment Methodology
 
Individual and team goals
Individual and team goalsIndividual and team goals
Individual and team goals
 
Project Automation
Project AutomationProject Automation
Project Automation
 
Hybris developer CV
Hybris developer CV Hybris developer CV
Hybris developer CV
 
Proposed Project Management Office
Proposed Project Management OfficeProposed Project Management Office
Proposed Project Management Office
 
Planning a Dinner Party for Four
Planning a Dinner Party for FourPlanning a Dinner Party for Four
Planning a Dinner Party for Four
 
Program Management Dashboards
Program Management DashboardsProgram Management Dashboards
Program Management Dashboards
 
Project Metrics & Measures
Project Metrics & MeasuresProject Metrics & Measures
Project Metrics & Measures
 
Fundamentals of Project Management
Fundamentals of Project ManagementFundamentals of Project Management
Fundamentals of Project Management
 
Implementing PMO
Implementing PMOImplementing PMO
Implementing PMO
 
Architecture + Process: BPM for Enterprise Architects
Architecture + Process: BPM for Enterprise ArchitectsArchitecture + Process: BPM for Enterprise Architects
Architecture + Process: BPM for Enterprise Architects
 
Business Model Analysis and Market Research for Startups and Entrepreneurs
Business Model Analysis and Market Research for Startups and EntrepreneursBusiness Model Analysis and Market Research for Startups and Entrepreneurs
Business Model Analysis and Market Research for Startups and Entrepreneurs
 
Program Management Office (PMO)
Program Management Office (PMO)Program Management Office (PMO)
Program Management Office (PMO)
 
Business case a_caponera
Business case a_caponeraBusiness case a_caponera
Business case a_caponera
 

Similar to R2DBC - Good Enough for Production?

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

Cloud Conference Day - Revolutionize Java Database App Development with React...
Cloud Conference Day - Revolutionize Java Database App Development with React...Cloud Conference Day - Revolutionize Java Database App Development with React...
Cloud Conference Day - Revolutionize Java Database App Development with React...
 
CloudTalks - Revolutionize Java DB AppDev with Reactive Streams and Virtual T...
CloudTalks - Revolutionize Java DB AppDev with Reactive Streams and Virtual T...CloudTalks - Revolutionize Java DB AppDev with Reactive Streams and Virtual T...
CloudTalks - Revolutionize Java DB AppDev with Reactive Streams and Virtual T...
 
GraphQL.net
GraphQL.netGraphQL.net
GraphQL.net
 
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
 

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

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 

Recently uploaded (20)

Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 

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.