Slide 1

Slide 1 text

A  Retrospective:     Couchbase  on  the  JVM   or  how  we’ve  built  the  first  reactive  driver  and  still  love  it       Michael  Nitschinger,  SDK  Engineer  

Slide 2

Slide 2 text

©2015  Couchbase  Inc.   2   Some  History  

Slide 3

Slide 3 text

©2015  Couchbase  Inc.   3   Memcached  

Slide 4

Slide 4 text

©2015  Couchbase  Inc.   4   Memcached  

Slide 5

Slide 5 text

©2015  Couchbase  Inc.   5   Membase  +  CouchOne  =  

Slide 6

Slide 6 text

©2015  Couchbase  Inc.   6   =  Couchbase  

Slide 7

Slide 7 text

©2015  Couchbase  Inc.   7   Java  SDK  1.x   § Extends  Spymemcached   § Adds  Config  &  View  Capabilities   § Stable  &  Mature   § Old  codebase,  difficult  to  maintain  and  evolve   § API  grew  organically  

Slide 8

Slide 8 text

©2015  Couchbase  Inc.   8   Spymemcached   §  Initial  Work  Started  mid  2006  (Java  5)   §  No  Generics   §  Memcached  ASCII  Protocol  

Slide 9

Slide 9 text

©2015  Couchbase  Inc.   9   API  Inconsistencies  

Slide 10

Slide 10 text

©2015  Couchbase  Inc.   10   Reworking  the  API  

Slide 11

Slide 11 text

©2015  Couchbase  Inc.   11   From  Key  Value  to  Documents   Key   Value   Views   N1QL   Search   mcd   ✔   1.8   ✔   2.0   ✔   ✔   3.0   ✔   ✔   4.0   ✔   ✔   ✔   .next   ✔   ✔   ✔   ✔  

Slide 12

Slide 12 text

©2015  Couchbase  Inc.   12   Reworking  the  API  –  The  Document  

Slide 13

Slide 13 text

©2015  Couchbase  Inc.   13   Reworking  the  API  –  2.x  

Slide 14

Slide 14 text

©2015  Couchbase  Inc.   14   Reworking  the  API  

Slide 15

Slide 15 text

©2015  Couchbase  Inc.   15   Rx  Semantics   single   multiple   sync   T   Iterable   async   Future   Observable  

Slide 16

Slide 16 text

©2015  Couchbase  Inc.   16   Rx  Semantics   Event   Iterable   Observable   data  retrieval   T  next()   onNext(T)   discover  error   throws  Exception   onError(Throwable)   complete   returns   onCompleted()  

Slide 17

Slide 17 text

©2015  Couchbase  Inc.   17   Consuming  Observables   17   §  The  Observer  subscribes     and  receives  events.   §  A  cold  Observable   starts  when  subscribed.   §  onNext  can  be  called   0..N  times  

Slide 18

Slide 18 text

©2015  Couchbase  Inc.   18   RxJava:  Creating  Observables   just 18  

Slide 19

Slide 19 text

©2015  Couchbase  Inc.   19   RxJava:  Creating  Observables   19  

Slide 20

Slide 20 text

©2015  Couchbase  Inc.   20   RxJava:  Creating  Observables   20  

Slide 21

Slide 21 text

©2015  Couchbase  Inc.   21   RxJava:  Creating  Observables   21  

Slide 22

Slide 22 text

©2015  Couchbase  Inc.   22   RxJava:  Creating  Observables   22  

Slide 23

Slide 23 text

©2015  Couchbase  Inc.   23   RxJava:  Creating  Observables   23  

Slide 24

Slide 24 text

©2015  Couchbase  Inc.   24   RxJava:  Transforming  Observables   24  

Slide 25

Slide 25 text

©2015  Couchbase  Inc.   25   RxJava:  Transforming  Observables   25  

Slide 26

Slide 26 text

©2015  Couchbase  Inc.   26   RxJava:  Transforming  Observables   26  

Slide 27

Slide 27 text

©2015  Couchbase  Inc.   27   RxJava:  Transforming  Observables   27  

Slide 28

Slide 28 text

©2015  Couchbase  Inc.   28   RxJava:  Transforming  Observables   28  

Slide 29

Slide 29 text

©2015  Couchbase  Inc.   29   RxJava:  Transforming  Observables   29  

Slide 30

Slide 30 text

©2015  Couchbase  Inc.   30   RxJava:  Transforming  Observables   30  

Slide 31

Slide 31 text

©2015  Couchbase  Inc.   31   RxJava:  Transforming  Observables   31  

Slide 32

Slide 32 text

©2015  Couchbase  Inc.   32   RxJava:  Transforming  Observables   32  

Slide 33

Slide 33 text

©2015  Couchbase  Inc.   33   RxJava:  Filtering  Observables   33  

Slide 34

Slide 34 text

©2015  Couchbase  Inc.   34   RxJava:  Filtering  Observables   34  

Slide 35

Slide 35 text

©2015  Couchbase  Inc.   35   RxJava:  Filtering  Observables   35  

Slide 36

Slide 36 text

©2015  Couchbase  Inc.   36   RxJava:  Filtering  Observables   36  

Slide 37

Slide 37 text

©2015  Couchbase  Inc.   37   Simple  Query   37  

Slide 38

Slide 38 text

©2015  Couchbase  Inc.   38   Parameterized  Query   38   §  Named  Params  

Slide 39

Slide 39 text

©2015  Couchbase  Inc.   39   Parametrized  Query   39   §  Positional  Params  

Slide 40

Slide 40 text

©2015  Couchbase  Inc.   40   Conditional  Index  Creation   40  

Slide 41

Slide 41 text

©2015  Couchbase  Inc.   41   Coordinated  Fallback   41  

Slide 42

Slide 42 text

©2015  Couchbase  Inc.   42   Coordinated  Retry:  Builder   42   §  Declarative  API  instead  of  complicated  retryWhen  

Slide 43

Slide 43 text

©2015  Couchbase  Inc.   43   Levelling  up  the  Architecture  

Slide 44

Slide 44 text

©2015  Couchbase  Inc.   44   Why  Reactive?   44  

Slide 45

Slide 45 text

©2015  Couchbase  Inc.   45   Java  !=  JVM  

Slide 46

Slide 46 text

©2015  Couchbase  Inc.   46   Architecture  

Slide 47

Slide 47 text

©2015  Couchbase  Inc.   47   Smart  Batching  

Slide 48

Slide 48 text

©2015  Couchbase  Inc.   48   Backpressure  

Slide 49

Slide 49 text

©2015  Couchbase  Inc.   49   Netty  

Slide 50

Slide 50 text

©2015  Couchbase  Inc.   50   Netty  –  In  the  next  Session!