Slide 1

Slide 1 text

Under the Hood of Reactive Data Access Mark Paluch @mp911de 1

Slide 2

Slide 2 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Modules 2 JPA

Slide 3

Slide 3 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Spring Data Modules 3 JPA

Slide 4

Slide 4 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ JDBC Fully-blocking API Non-blocking API announced (JDK-8188051) 4 http://mail.openjdk.java.net/pipermail/jdbc-spec-discuss/ • JDK-8188051: http://hg.openjdk.java.net/jdk10/sandbox/jdk/rev/a31057bda7c5

Slide 5

Slide 5 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Relational Databases Limited scalability Resource synchronization Transactions 5

Slide 6

Slide 6 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Query by time 6 Transport

Slide 7

Slide 7 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Synchronous Data Access 7 Data store App Data store App Data store

Slide 8

Slide 8 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Data Access 8 Data store App Data store Data store Data store App

Slide 9

Slide 9 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Differences to imperative Data Access Drivers require threading infrastructure Timeout handling different 9

Slide 10

Slide 10 text

Reactive NoSql drivers

Slide 11

Slide 11 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive drivers End-to-end nonblocking Asynchronous request-response processing Non-blocking pooling Non-blocking connect 11

Slide 12

Slide 12 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Application Driver Application 12 Request Server selection Queueing Write Response decoding Response buffering Request completion Response

Slide 13

Slide 13 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ MongoDB Reactive-over-async driver Cursor lifecycle Pluggable I/O Pooled connections 13

Slide 14

Slide 14 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Query by time 14 Request Response (chunk) Response (complete) Prefetch (cont.d) Query Emit elements Result processing

Slide 15

Slide 15 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ MongoDB Driver Fetching 15 Operator MongoDB Subscriber request(Long.MAX_VALUE) request(Long.MAX_VALUE)

Slide 16

Slide 16 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ MongoDB Driver Fetching 16 Filter MongoDB Subscriber request(Long.MAX_VALUE) request(Long.MAX_VALUE)

Slide 17

Slide 17 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ MongoDB Driver Fetching 17 Operator (filter) MongoDB Subscriber request(1) Dropped element request(Long.MAX_VALUE)

Slide 18

Slide 18 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Specific Features Tailable Cursors (@Tailable) MongoDB 3.6: Change Streams 18 Cursor size derived from demand

Slide 19

Slide 19 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Redis Reactive driver (Lettuce 5) Based on Netty and Project Reactor Singleton connection Pooled connections 19

Slide 20

Slide 20 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Command by time 20 Request Command Command (subscription) Response (chunk) Response (complete)

Slide 21

Slide 21 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Specifics Use ByteBuffer instead byte[] @null handling: Emission of empty buffers Suspend reading if no demand 21

Slide 22

Slide 22 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Apache Cassandra Reactive bridge over async driver Netty-based driver (Datastax) Pooled connections 22

Slide 23

Slide 23 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Query by time 23 Request Response (chunk) Response (complete) Query Emit elements Result processing Next page

Slide 24

Slide 24 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Outlook Cassandra driver 4.0 in the works Likely support for reactive execution model Emit items as they are received 24 https://github.com/datastax/java-driver/tree/4.x • https://datastax-oss.atlassian.net/browse/JAVA-1505

Slide 25

Slide 25 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Couchbase Reactive driver driver Based on Netty and RxJava 1 Multiple connection schemes 25

Slide 26

Slide 26 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Couchbase Fetching Key-Value, DCP 1. Request 2. Response 3. Emit results
 Search, Query, View 1. Request 2. Response streaming 26

Slide 27

Slide 27 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Command by time 27 Request Command Command (subscription) Response (chunk) Response (complete)

Slide 28

Slide 28 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Outlook Couchbase driver likely to move to RxJava 2 • No tickets/decisions yet 28

Slide 29

Slide 29 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Resources Slides – mp911.de/s1p-hood-slides Example Code – mp911.de/s1p-hood-code Spring Data Examples – Repository @ Github Find us on Gitter! 29

Slide 30

Slide 30 text

Feedback welcome

Slide 31

Slide 31 text

Learn More. Stay Connected. 31 #springone @s1p

Slide 32

Slide 32 text

Disclaimer

Slide 33

Slide 33 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Safe Harbor Statement The following is intended to outline the general direction of Pivotal's offerings. It is intended for information purposes only and may not be incorporated into any contract. Any information regarding pre-release of Pivotal offerings, future updates or other planned modifications is subject to ongoing evaluation by Pivotal and is subject to change. This information is provided without warranty or any kind, express or implied, and is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions regarding Pivotal's offerings. These purchasing decisions should only be based on features currently available. The development, release, and timing of any features or functionality described for Pivotal's offerings in this presentation remain at the sole discretion of Pivotal. Pivotal has no obligation to update forward looking information in this presentation. 33