Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Under the Hood of Reactive Data Access

Under the Hood of Reactive Data Access

Slides to the presentation I gave at Spring I/O 2018

Conference page: https://2018.springio.net/sessions/under-the-hood-of-reactive-data-access
GitHub repository: https://github.com/mp911de/under-the-hood-reactive

Mark Paluch

May 24, 2018
Tweet

More Decks by Mark Paluch

Other Decks in Programming

Transcript

  1. Relational Databases •Not a good fit for reactive access •Limited

    scalability •Resource synchronization •ACID Transactions
  2. JDBC •Fully blocking API •Non-blocking API announced: ADBA 
 (JDK-8188051)

    http://mail.openjdk.java.net/pipermail/jdbc-spec-discuss/ • JDK-8188051: http://hg.openjdk.java.net/jdk/sandbox/shortlog/JDK-8188051-branch
  3. Redis •Reactive driver (Lettuce 5) •Based on Netty and Project

    Reactor •Singleton connection •Optionally: Pooled connections
  4. Outlook •Cassandra driver 4.0 in the works •Likely support for

    reactive execution model •Emit items as they are received https://github.com/datastax/java-driver/tree/4.x • https://datastax-oss.atlassian.net/browse/JAVA-1505
  5. Imperative and Reactive @Component public class ApplicationInitializer { ReactiveMongoOperations ops;

    @PostConstruct public void postConstruct() { ops.remove(Person.class).all().block(); } }
  6. Imperative and Reactive @Component public class ApplicationInitializer { ReactiveMongoOperations ops;

    @PostConstruct public void postConstruct() { ops.remove(Person.class).all().block(); } }
  7. Event Loop Process next item Callback Register Callback Return Work

    Database Computation File I/O Event Loop (single Thread) Work Queue Work Request Callback
  8. Event Loop Event Loop (single Thread) Work Queue Process next

    item Work Callback Work Wait for Request completion Return Request Request Callback
  9. Event Loop Event Loop (single Thread) Work Queue Process next

    item Work Callback Work Wait for Request completion Return Request Request Callback