SlideShare uma empresa Scribd logo
1 de 118
Baixar para ler offline
Terracotta Ehcache Consistency
Strong and Eventual
Abhishek Sanoujam
March 29, 2011
Ehcache-2.4 + Terracotta 3.5

   Search
     –   http://ehcache.org/documentation/search.html
   New Consistency modes
     –   http://ehcache.org/documentation/terracotta/
         consistency_options.html
   Nonstop feature
     –   http://ehcache.org/documentation/terracotta/non_stop_cache.html
   Rejoin
   Explicit locking api merged to Ehcache interface
   Various other perf improvements and bug fixes
     –   http://ehcache.org

                                Terracotta Ehcache Consistency             2
Terracotta Ehcache Consistency




                 Terracotta Ehcache Consistency   3
Terracotta Ehcache Consistency

   New attribute “consistency” in “terracotta” sub-element of
    “cache” in ehcache.xml




                           Terracotta Ehcache Consistency        3
Terracotta Ehcache Consistency

   New attribute “consistency” in “terracotta” sub-element of
    “cache” in ehcache.xml
    <cache name=”sampleCache”>
       <terracotta consistency=”strong|eventual” />
    </cache>




                           Terracotta Ehcache Consistency        3
Terracotta Ehcache Consistency

   New attribute “consistency” in “terracotta” sub-element of
    “cache” in ehcache.xml
    <cache name=”sampleCache”>
       <terracotta consistency=”strong|eventual” />
    </cache>
   Consistency can be “strong” or “eventual”




                           Terracotta Ehcache Consistency        3
Terracotta Ehcache Consistency

   New attribute “consistency” in “terracotta” sub-element of
    “cache” in ehcache.xml
    <cache name=”sampleCache”>
       <terracotta consistency=”strong|eventual” />
    </cache>
   Consistency can be “strong” or “eventual”
   Old “coherent” attribute deprecated




                           Terracotta Ehcache Consistency        3
Terracotta Ehcache Consistency

   New attribute “consistency” in “terracotta” sub-element of
    “cache” in ehcache.xml
    <cache name=”sampleCache”>
       <terracotta consistency=”strong|eventual” />
    </cache>
   Consistency can be “strong” or “eventual”
   Old “coherent” attribute deprecated
   With “strong” consistency, changes made by any node in
    the cluster are visible instantly




                           Terracotta Ehcache Consistency        3
Terracotta Ehcache Consistency

   New attribute “consistency” in “terracotta” sub-element of
    “cache” in ehcache.xml
    <cache name=”sampleCache”>
       <terracotta consistency=”strong|eventual” />
    </cache>
   Consistency can be “strong” or “eventual”
   Old “coherent” attribute deprecated
   With “strong” consistency, changes made by any node in
    the cluster are visible instantly
   With “eventual” consistency, changes made by any node
    are visible to other nodes eventually


                           Terracotta Ehcache Consistency        3
Terracotta Ehcache Consistency

   New attribute “consistency” in “terracotta” sub-element of
    “cache” in ehcache.xml
    <cache name=”sampleCache”>
       <terracotta consistency=”strong|eventual” />
    </cache>
   Consistency can be “strong” or “eventual”
   Old “coherent” attribute deprecated
   With “strong” consistency, changes made by any node in
    the cluster are visible instantly
   With “eventual” consistency, changes made by any node
    are visible to other nodes eventually
   http://ehcache.org/documentation/terracotta/consistency_options.html


                              Terracotta Ehcache Consistency               3
Strong Consistency




                 Terracotta Ehcache Consistency   4
Strong Consistency

   Changes are visible cluster-wide instantly




                             Terracotta Ehcache Consistency   4
Strong Consistency

 Changes are visible cluster-wide instantly
 Reads/Writes uses clustered locks
    – Clustered locks same as normal read-write locks, but valid
      through the cluster
    – Multiple reads possible
    – Writes are mutually exclusive to other writes and reads




                              Terracotta Ehcache Consistency       4
Strong Consistency

 Changes are visible cluster-wide instantly
 Reads/Writes uses clustered locks
     – Clustered locks same as normal read-write locks, but valid
       through the cluster
     – Multiple reads possible
     – Writes are mutually exclusive to other writes and reads

   Honors happens-before cluster wide (using clustered locks)




                               Terracotta Ehcache Consistency       4
Strong Consistency

 Changes are visible cluster-wide instantly
 Reads/Writes uses clustered locks
    – Clustered locks same as normal read-write locks, but valid
      through the cluster
    – Multiple reads possible
    – Writes are mutually exclusive to other writes and reads

 Honors happens-before cluster wide (using clustered locks)
 Supports other concurrent apis
    – putIfAbsent(Element element)
    – removeElement(Element element)
    – replace(Element element)
    – replace(Element old, Element element)




                               Terracotta Ehcache Consistency      4
Strong Consistency

 Changes are visible cluster-wide instantly
 Reads/Writes uses clustered locks
     – Clustered locks same as normal read-write locks, but valid
       through the cluster
     – Multiple reads possible
     – Writes are mutually exclusive to other writes and reads

 Honors happens-before cluster wide (using clustered locks)
 Supports other concurrent apis
     – putIfAbsent(Element element)
     – removeElement(Element element)
     – replace(Element element)
     – replace(Element old, Element element)
   Works with explicit locking apis

                                 Terracotta Ehcache Consistency     4
Eventual Consistency




                 Terracotta Ehcache Consistency   5
Eventual Consistency
   Changes are visible to other nodes eventually (in order of ms)




                                 Terracotta Ehcache Consistency      5
Eventual Consistency
 Changes are visible to other nodes eventually (in order of ms)
 L2 notifies clients about which keys were updated




                               Terracotta Ehcache Consistency      5
Eventual Consistency
 Changes are visible to other nodes eventually (in order of ms)
 L2 notifies clients about which keys were updated
 On receiving update from L2, those mappings are removed from
  clients local cache




                              Terracotta Ehcache Consistency       5
Eventual Consistency
 Changes are visible to other nodes eventually (in order of ms)
 L2 notifies clients about which keys were updated
 On receiving update from L2, those mappings are removed from
  clients local cache
 Can read stale data for some time (in order of msecs)




                              Terracotta Ehcache Consistency       5
Eventual Consistency
   Changes are visible to other nodes eventually (in order of ms)
   L2 notifies clients about which keys were updated
   On receiving update from L2, those mappings are removed from
    clients local cache
   Can read stale data for some time (in order of msecs)
   Suitable for apps that can tolerate reading stale data




                                Terracotta Ehcache Consistency       5
Eventual Consistency
   Changes are visible to other nodes eventually (in order of ms)
   L2 notifies clients about which keys were updated
   On receiving update from L2, those mappings are removed from
    clients local cache
   Can read stale data for some time (in order of msecs)
   Suitable for apps that can tolerate reading stale data
   No need of locks for reads/writes
     –   Better performance compared to strong consistency




                                   Terracotta Ehcache Consistency    5
Eventual Consistency
   Changes are visible to other nodes eventually (in order of ms)
   L2 notifies clients about which keys were updated
   On receiving update from L2, those mappings are removed from
    clients local cache
   Can read stale data for some time (in order of msecs)
   Suitable for apps that can tolerate reading stale data
   No need of locks for reads/writes
     –   Better performance compared to strong consistency
   Supports other concurrent apis
     –   putIfAbsent(Element element)
     –   removeElement(Element element)
     –   replace(Element element)
     –   replace(Element old, Element element)




                                           Terracotta Ehcache Consistency   5
Eventual Consistency
   Changes are visible to other nodes eventually (in order of ms)
   L2 notifies clients about which keys were updated
   On receiving update from L2, those mappings are removed from
    clients local cache
   Can read stale data for some time (in order of msecs)
   Suitable for apps that can tolerate reading stale data
   No need of locks for reads/writes
     –   Better performance compared to strong consistency
   Supports other concurrent apis
     –   putIfAbsent(Element element)
     –   removeElement(Element element)
     –   replace(Element element)
     –   replace(Element old, Element element)
   Works with explicit locking apis
     –   provides more control over locking

                                           Terracotta Ehcache Consistency   5
Old “coherent” attribute deprecated




                  Terracotta Ehcache Consistency   6
Old “coherent” attribute deprecated

   Old “coherent” attribute deprecated




                           Terracotta Ehcache Consistency   6
Old “coherent” attribute deprecated

   Old “coherent” attribute deprecated
   coherent=”true” translates to consistency=”strong”




                           Terracotta Ehcache Consistency   6
Old “coherent” attribute deprecated

   Old “coherent” attribute deprecated
   coherent=”true” translates to consistency=”strong”
   coherent=”false” translates to consistency=”eventual”




                           Terracotta Ehcache Consistency   6
Old “coherent” attribute deprecated

   Old “coherent” attribute deprecated
   coherent=”true” translates to consistency=”strong”
   coherent=”false” translates to consistency=”eventual”
   Old coherent=”false” meant bulk-load mode (incoherent
    mode)
     – Cannot be set in config (use “eventual” consistency instead)
     – possible through api only now
        • setNodeBulkLoadEnabled(true)
        • setNodeBulkLoadEnabled(false)




                               Terracotta Ehcache Consistency         6
Bulk-load mode




                 Terracotta Ehcache Consistency   7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode




                                  Terracotta Ehcache Consistency   7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode
   No locks are required for reads/writes




                                   Terracotta Ehcache Consistency   7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode
   No locks are required for reads/writes
   Writes are batched heavily in the client (L1)




                                    Terracotta Ehcache Consistency   7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode
   No locks are required for reads/writes
 Writes are batched heavily in the client (L1)
 Warmup of large caches happens pretty fast




                                   Terracotta Ehcache Consistency   7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode
   No locks are required for reads/writes
 Writes are batched heavily in the client (L1)
 Warmup of large caches happens pretty fast
   Once values are fetched, changes/updates by other nodes visible after
    specific time (5 mins by default)




                                   Terracotta Ehcache Consistency           7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode
   No locks are required for reads/writes
 Writes are batched heavily in the client (L1)
 Warmup of large caches happens pretty fast
   Once values are fetched, changes/updates by other nodes visible after
    specific time (5 mins by default)
   Possible through api only




                                   Terracotta Ehcache Consistency           7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode
   No locks are required for reads/writes
 Writes are batched heavily in the client (L1)
 Warmup of large caches happens pretty fast
   Once values are fetched, changes/updates by other nodes visible after
    specific time (5 mins by default)
   Possible through api only
   Old api’s are deprecated
     –   setNodeCoherent(boolean coherent)
     –   isNodeCoherent()
     –   isClusterCoherent()
     –   waitUntilClusterCoherent()




                                       Terracotta Ehcache Consistency       7
Bulk-load mode
   coherent=”false” - bulk load mode or incoherent mode
   No locks are required for reads/writes
 Writes are batched heavily in the client (L1)
 Warmup of large caches happens pretty fast
   Once values are fetched, changes/updates by other nodes visible after
    specific time (5 mins by default)
   Possible through api only
   Old api’s are deprecated
     –   setNodeCoherent(boolean coherent)
     –   isNodeCoherent()
     –   isClusterCoherent()
     –   waitUntilClusterCoherent()
   New api’s added in Ehcache interface:
     –   setNodeBulkLoadEnabled(boolean enabledBulkLoad)
     –   isNodeBulkLoadEnabled()
     –   isClusterBulkLoadEnabled()
     –   waitUntilClusterBulkLoadComplete()
                                         Terracotta Ehcache Consistency     7
How it works - Strong Consistency




                 Terracotta Ehcache Consistency   8
How it works - Strong Consistency


             Terracotta Server Array (L2)




    Node A             Node B                           Node C
     (L1)               (L1)                             (L1)




                       Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                Terracotta Server Array (L2)




    Node A                Node B                           Node C
     (L1)                  (L1)                             (L1)


      put(k1, v1)


                          Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                  Terracotta Server Array (L2)




    acquireLock
    (WRITE)




    Node A                  Node B                           Node C
     (L1)                    (L1)                             (L1)


       put(k1, v1)


                            Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                  Terracotta Server Array (L2)




    acquireLock
                     grant lock
    (WRITE)




    Node A                    Node B                           Node C
     (L1)                      (L1)                             (L1)


       put(k1, v1)


                              Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                  Terracotta Server Array (L2)




    acquireLock
                     grant lock
    (WRITE)
   put(k1, v1)



    Node A                    Node B                           Node C
     (L1)                      (L1)                             (L1)


       put(k1, v1)


                              Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                  Terracotta Server Array (L2)
                           (k1, v1 )


    acquireLock
                     grant lock
    (WRITE)
   put(k1, v1)



    Node A                    Node B                           Node C
     (L1)                      (L1)                             (L1)


       put(k1, v1)


                              Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                  Terracotta Server Array (L2)
                           (k1, v1 )


    acquireLock
                     grant lock
    (WRITE)
   put(k1, v1)



     Node A                   Node B                           Node C
      (L1)                     (L1)                             (L1)
    (k1, v1)

       put(k1, v1)


                              Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                  Terracotta Server Array (L2)
                           (k1, v1 )


    acquireLock
                     grant lock
    (WRITE)
   put(k1, v1)



     Node A                   Node B                           Node C
      (L1)                     (L1)                             (L1)
    (k1, v1)

       put(k1, v1)      get(k1)


                              Terracotta Ehcache Consistency            8
How it works - Strong Consistency


                  Terracotta Server Array (L2)
                           (k1, v1 )


    acquireLock
                     grant lock
    (WRITE)
   put(k1, v1)



     Node A                   Node B                               Node C
      (L1)                     (L1)                                 (L1)
    (k1, v1)

       put(k1, v1)      get(k1)                                get(k1)


                              Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                  Terracotta Server Array (L2)
                           (k1, v1 )


    acquireLock
                     grant lock
    (WRITE)
   put(k1, v1)
                      acquireLock
                      (READ)                             acquireLock
                                                         (READ)

     Node A                   Node B                               Node C
      (L1)                     (L1)                                 (L1)
    (k1, v1)

       put(k1, v1)      get(k1)                                get(k1)


                              Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                     Terracotta Server Array (L2)
                             (k1, v1 )


    acquireLock
                      grant lock
    (WRITE) recall
   put(k1, v1)
                        acquireLock
                        (READ)                             acquireLock
                                                           (READ)

     Node A                     Node B                               Node C
      (L1)                       (L1)                                 (L1)
    (k1, v1)

        put(k1, v1)       get(k1)                                get(k1)


                                Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                     Terracotta Server Array (L2)
                             (k1, v1 )


    acquireLock
                      grant lock
    (WRITE) recall
   put(k1, v1)
                        acquireLock
                        (READ)                             acquireLock
                                                           (READ)

     Node A                     Node B                               Node C
      (L1)                       (L1)                                 (L1)
    (k1, v1)

        put(k1, v1)       get(k1)                                get(k1)


                                Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                     Terracotta Server Array (L2)
                             (k1, v1 )


    acquireLock                           grant read
                      grant lock
    (WRITE)                               lock
            recall
   put(k1, v1)
                        acquireLock
                        (READ)                             acquireLock
                                                           (READ)

     Node A                     Node B                               Node C
      (L1)                       (L1)                                 (L1)
    (k1, v1)

        put(k1, v1)       get(k1)                                get(k1)


                                Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                     Terracotta Server Array (L2)
                             (k1, v1 )


    acquireLock                           grant read               grant read
                      grant lock                                   lock
    (WRITE)                               lock
            recall
   put(k1, v1)
                        acquireLock
                        (READ)                             acquireLock
                                                           (READ)

     Node A                     Node B                               Node C
      (L1)                       (L1)                                 (L1)
    (k1, v1)

        put(k1, v1)       get(k1)                                get(k1)


                                Terracotta Ehcache Consistency                  8
How it works - Strong Consistency


                     Terracotta Server Array (L2)
                             (k1, v1 )


    acquireLock                    grant read      grant read
                      grant lock                   lock
    (WRITE)                        lock
            recall      get(k1)
   put(k1, v1)                            get(k1)
                       acquireLock
                       (READ)              acquireLock
                                           (READ)

     Node A                     Node B                               Node C
      (L1)                       (L1)                                 (L1)
    (k1, v1)

        put(k1, v1)       get(k1)                                get(k1)


                                Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                     Terracotta Server Array (L2)
                             (k1, v1 )


    acquireLock                    grant read      grant read
                      grant lock                   lock
    (WRITE)                        lock
            recall      get(k1)
   put(k1, v1)                      v1    get(k1)     v1
                       acquireLock
                       (READ)              acquireLock
                                           (READ)

     Node A                     Node B                               Node C
      (L1)                       (L1)                                 (L1)
    (k1, v1)

        put(k1, v1)       get(k1)                                get(k1)


                                Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                     Terracotta Server Array (L2)
                             (k1, v1 )


    acquireLock                    grant read      grant read
                      grant lock                   lock
    (WRITE)                        lock
            recall      get(k1)
   put(k1, v1)                      v1    get(k1)     v1
                       acquireLock
                       (READ)              acquireLock
                                           (READ)

     Node A                     Node B                               Node C
      (L1)                        (L1)                                 (L1)
    (k1, v1)                    (k1, v1)                              (k1, v1)

        put(k1, v1)       get(k1)                                get(k1)


                                Terracotta Ehcache Consistency                   8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v1 )


        acquireLock                    grant read      grant read
                          grant lock                   lock
        (WRITE)                        lock
                recall      get(k1)
       put(k1, v1)                      v1    get(k1)     v1
                           acquireLock
                           (READ)              acquireLock
                                               (READ)

         Node A                     Node B                               Node C
          (L1)                        (L1)                                 (L1)
        (k1, v1)                    (k1, v1)                              (k1, v1)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                   8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v1 )


        acquireLock                    grant read      grant read
                          grant lock                   lock
        (WRITE)                        lock
                recall      get(k1)
       put(k1, v1)                      v1    get(k1)     v1
                           acquireLock
                           (READ)              acquireLock
                                               (READ)

         Node A                     Node B                               Node C
          (L1)                        (L1)                                 (L1)
        (k1, v1)                    (k1, v1)                              (k1, v1)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                   8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v1 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
       put(k1, v1)                      v1     get(k1)     v1
                           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

         Node A                     Node B                               Node C
          (L1)                        (L1)                                 (L1)
        (k1, v1)                    (k1, v1)                              (k1, v1)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                   8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v1 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
       put(k1, v1)                      v1     get(k1)     v1
                           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

         Node A                     Node B                               Node C
          (L1)                       (L1)                                 (L1)


put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v1 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
       put(k1, v1)                      v1     get(k1)     v1
                           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

         Node A                     Node B                               Node C
          (L1)                       (L1)                                 (L1)


put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v1 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

         Node A                     Node B                               Node C
          (L1)                       (L1)                                 (L1)


put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

         Node A                     Node B                               Node C
          (L1)                       (L1)                                 (L1)


put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                    grant read       grant read
                          grant lock                    lock
        (WRITE)                        lock
                recall      get(k1)
      put(k1, v1)                       v1     get(k1)     v1
     put(k1, v2)           acquireLock
                           (READ)               acquireLock recall
                                         recall
                                                (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                   grant read       grant read
                          grant lock                   lock
        (WRITE)                       lock
                recall      get(k1)
      put(k1, v1)                      v1                 v1
     put(k1, v2)           acquireLock v2 get(k1)
                           (READ)              acquireLock v2recall
                                        recall
                                               (READ)

        Node A                      Node B                               Node C
           (L1)                      (L1)                                 (L1)
      (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                   grant read       grant read
                          grant lock                   lock
        (WRITE)                       lock
                recall      get(k1)
      put(k1, v1)                      v1                 v1
     put(k1, v2)           acquireLock v2 get(k1)
                           (READ)              acquireLock v2recall
                                        recall
                                               (READ)

        Node A                     Node B                                Node C
           (L1)                      (L1)                                  (L1)
      (k1, v2)                   (k1, v2)                                (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                  8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                   grant read       grant read
                          grant lock                   lock
        (WRITE)                       lock
                recall      get(k1)
      put(k1, v1)                      v1                 v1
     put(k1, v2)           acquireLock v2 get(k1)
                           (READ)              acquireLock v2recall
                                        recall
                                               (READ)

        Node A                     Node B                                Node C
           (L1)                      (L1)                                  (L1)
      (k1, v2)                   (k1, v2)                                (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                  8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                   grant read       grant read
                          grant lock                   lock
        (WRITE)                       lock
                recall      get(k1)
      put(k1, v1)                      v1                 v1
     put(k1, v2)           acquireLock v2 get(k1)
                           (READ)              acquireLock v2recall
                                        recall
                                               (READ)

        Node A                     Node B                                Node C
           (L1)                      (L1)                                  (L1)
      (k1, v2)                   (k1, v2)                                (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)                                get(k1)


                                    Terracotta Ehcache Consistency                  8
How it works - Strong Consistency


                         Terracotta Server Array (L2)
                                 (k1, v2 )


        acquireLock                   grant read       grant read
                          grant lock                   lock
        (WRITE)                       lock
                recall      get(k1)
      put(k1, v1)                      v1                 v1
     put(k1, v2)           acquireLock v2 get(k1)
                           (READ)              acquireLock v2recall
                                        recall
                                               (READ)

        Node A                     Node B                                Node C
           (L1)                      (L1)                                  (L1)
      (k1, v2)                   (k1, v2)                                (k1, v2)

put(k1, v2) put(k1, v1)       get(k1)         v2                     get(k1)   v2


                                    Terracotta Ehcache Consistency                  8
How it works - Eventual Consistency




                 Terracotta Ehcache Consistency   9
How it works - Eventual Consistency


             Terracotta Server Array (L2)




    Node A             Node B                           Node C
     (L1)               (L1)                             (L1)




                       Terracotta Ehcache Consistency            9
How it works - Eventual Consistency


                Terracotta Server Array (L2)




    Node A                Node B                           Node C
     (L1)                  (L1)                             (L1)


      put(k1, v1)


                          Terracotta Ehcache Consistency            9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)




   put(k1, v1)



     Node A                 Node B                           Node C
      (L1)                   (L1)                             (L1)


        put(k1, v1)


                            Terracotta Ehcache Consistency            9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)
                          (k1, v1 )




   put(k1, v1)



     Node A                  Node B                           Node C
      (L1)                    (L1)                             (L1)


        put(k1, v1)


                             Terracotta Ehcache Consistency            9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)
                          (k1, v1 )




   put(k1, v1)



     Node A                  Node B                           Node C
       (L1)                   (L1)                             (L1)
     (k1, v1)

        put(k1, v1)


                             Terracotta Ehcache Consistency            9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)
                          (k1, v1 )




   put(k1, v1)



     Node A                  Node B                           Node C
       (L1)                   (L1)                             (L1)
     (k1, v1)

        put(k1, v1)   get(k1)


                             Terracotta Ehcache Consistency            9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)
                          (k1, v1 )




   put(k1, v1)



     Node A                  Node B                                Node C
       (L1)                   (L1)                                  (L1)
     (k1, v1)

        put(k1, v1)   get(k1)                                 get(k1)


                             Terracotta Ehcache Consistency                 9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)
                          (k1, v1 )



                      get(k1)
   put(k1, v1)                                      get(k1)



     Node A                  Node B                                Node C
       (L1)                   (L1)                                  (L1)
     (k1, v1)

        put(k1, v1)   get(k1)                                 get(k1)


                             Terracotta Ehcache Consistency                 9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)
                          (k1, v1 )



                      get(k1)
   put(k1, v1)                          v1          get(k1)        v1



     Node A                  Node B                                Node C
       (L1)                   (L1)                                  (L1)
     (k1, v1)

        put(k1, v1)   get(k1)                                 get(k1)


                             Terracotta Ehcache Consistency                 9
How it works - Eventual Consistency


                  Terracotta Server Array (L2)
                          (k1, v1 )



                      get(k1)
   put(k1, v1)                          v1          get(k1)        v1



     Node A                  Node B                                Node C
       (L1)                    (L1)                                  (L1)
     (k1, v1)                (k1, v1)                               (k1, v1)

        put(k1, v1)   get(k1)                                 get(k1)


                             Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v1 )



                          get(k1)
       put(k1, v1)                          v1          get(k1)        v1



         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
         (k1, v1)                (k1, v1)                               (k1, v1)

put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v1 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
         (k1, v1)                (k1, v1)                               (k1, v1)

put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
         (k1, v1)                (k1, v1)                               (k1, v1)

put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
       (k1, v2)
         (k1, v1)                (k1, v1)                               (k1, v1)

put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
       (k1, v2)
         (k1, v1)                (k1, v1)                               (k1, v1)

put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
       (k1, v2)
         (k1, v1)                (k1, v1)                               (k1, v1)

put(k1, v2) put(k1, v1)   get(k1)           v1                    get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
       (k1, v2)
         (k1, v1)                (k1, v1)                               (k1, v1)

put(k1, v2) put(k1, v1)   get(k1)           v1                    get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
       (k1, v2)
         (k1, v1)                (k1, v1)                               (k1, v1)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1


         Node A                  Node B                                Node C
           (L1)                    (L1)                                  (L1)
       (k1, v2)
         (k1, v1)                (k1, v1)                               (k1, v1)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                    9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1


         Node A                  Node B                                Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1


         Node A                  Node B                                Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1


         Node A                  Node B                                Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1
                                             v2                         v2

         Node A                  Node B                                Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1
                                             v2                         v2

         Node A                 Node B                                 Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)             (k1, v2)                                (k1, v2)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)


                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1
                                             v2                         v2

         Node A                 Node B                                 Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)             (k1, v2)                                (k1, v2)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)    v2
                                            v2

                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1
                                             v2                         v2

         Node A                 Node B                                 Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)             (k1, v2)                                (k1, v2)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)    v2
                                            v2

                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1
                                             v2                         v2

         Node A                 Node B                                 Node C
           (L1)                   (L1)                                  (L1)
       (k1, v2)
         (k1, v1)             (k1, v2)                                (k1, v2)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)    v2
                                            v2

                                 Terracotta Ehcache Consistency                   9
How it works - Eventual Consistency


                      Terracotta Server Array (L2)
                              (k1, v2 )



                          get(k1)
      put(k1, v1)                           v1          get(k1)        v1
     put(k1, v2)                            k1                          k1
                                             v2                         v2

         Node A                 Node B                                 Node C
          (L1)                    (L1)                                  (L1)
       (k1, v2)               (k1, v2)                                (k1, v2)

                                            v1                               v1
put(k1, v2) put(k1, v1)   get(k1)                                 get(k1)    v2
                                            v2

                                 Terracotta Ehcache Consistency                   9
How it works - Bulk load mode




                 Terracotta Ehcache Consistency   10
How it works - Bulk load mode

   Similar to eventual consistency
     –   No locks required




                             Terracotta Ehcache Consistency   10
How it works - Bulk load mode

   Similar to eventual consistency
     –   No locks required
   Puts are batched heavily in the L1




                             Terracotta Ehcache Consistency   10
How it works - Bulk load mode

   Similar to eventual consistency
     –   No locks required
   Puts are batched heavily in the L1
   The L2 don’t send out invalidation notifications




                             Terracotta Ehcache Consistency   10
How it works - Bulk load mode

   Similar to eventual consistency
     –   No locks required
   Puts are batched heavily in the L1
   The L2 don’t send out invalidation notifications
   Invalidations in the local cache happen based on time (5
    mins by default)




                             Terracotta Ehcache Consistency    10
How it works - Bulk load mode

   Similar to eventual consistency
     –   No locks required
   Puts are batched heavily in the L1
   The L2 don’t send out invalidation notifications
   Invalidations in the local cache happen based on time (5
    mins by default)
   Apps read stale data for the specified time interval
      – configurable via tc property
        “ehcache.storageStrategy.dcv2.localcache.incoherentReadTimeout”




                               Terracotta Ehcache Consistency             10
Comparison

   Strong consistency
     – Reads/Writes happen under locks
     – Invalidations of local cache happens when a node acquires
       WRITE locks
   Eventual Consistency
     – Reads/Writes do not require locks
     – L2 notifies about changes to interested nodes
     – L1 invalidates local cache upon receiving notification from L2
     – Notifications are batched and sent to only interested nodes

   Bulk-load mode
     – No locks required
     – Invalidations happen based on time (5 mins by default)
     – Puts are batched heavily in the L1

                               Terracotta Ehcache Consistency           11
Summary

   Strong consistency
     –   Pros
          • Provides coherent data across the cluster
          • Changes visible to all nodes instantly
          • Honors happens-before cluster wide
     –   Cons
          • If coherent cache not desired, suffers from performance
          • Needs locks for both reads and writes
          • May result in lock hopping when data not partitioned leading to perf
            degradation




                                  Terracotta Ehcache Consistency                   12
Summary




          Terracotta Ehcache Consistency   13
Summary

   Eventual Consistency
     – Pros
        • No need of locks for reads/writes
        • Better performance
        • Changes are visible across cluster in order of ms
     – Cons
        • Application can read stale data for some time




                                Terracotta Ehcache Consistency   13
Summary

   Eventual Consistency
     – Pros
        • No need of locks for reads/writes
        • Better performance
        • Changes are visible across cluster in order of ms
     – Cons
        • Application can read stale data for some time

   Bulk Load mode
     – Pros
        • No need of locks for reads/writes
        • Better performance for puts, useful for cache warmup
     – Cons
        • Application can read stale data for longer amount of time
        • Values once fetched, will see changes after specific amount of time


                                Terracotta Ehcache Consistency                  13
Thank you!
Abhishek Sanoujam
asanoujam@terracottatech.com

http://terracotta.org
http://ehcache.org
http://ehcache.org/documentation/terracotta/consistency_options.html

Mais conteúdo relacionado

Semelhante a Eventual consistency

Building High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaBuilding High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaDavid Reines
 
Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...
Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...
Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...Paul Brebner
 
Ozone- Object store for Apache Hadoop
Ozone- Object store for Apache HadoopOzone- Object store for Apache Hadoop
Ozone- Object store for Apache HadoopHortonworks
 
All you didn't know about the CAP theorem
All you didn't know about the CAP theoremAll you didn't know about the CAP theorem
All you didn't know about the CAP theoremKanstantsin Hontarau
 
Hadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in ProductionHadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in ProductionDataWorks Summit/Hadoop Summit
 
Cassandra 2.1 boot camp, Read/Write path
Cassandra 2.1 boot camp, Read/Write pathCassandra 2.1 boot camp, Read/Write path
Cassandra 2.1 boot camp, Read/Write pathJoshua McKenzie
 
Hadoop & cloud storage object store integration in production (final)
Hadoop & cloud storage  object store integration in production (final)Hadoop & cloud storage  object store integration in production (final)
Hadoop & cloud storage object store integration in production (final)Chris Nauroth
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Baruch Sadogursky
 
SVN session from PiTechnologies
SVN session from PiTechnologies SVN session from PiTechnologies
SVN session from PiTechnologies PiTechnologies
 
24 collections framework interview questions
24 collections framework interview questions24 collections framework interview questions
24 collections framework interview questionsArun Vasanth
 
Future on Servlet #scala_ks
Future on Servlet #scala_ksFuture on Servlet #scala_ks
Future on Servlet #scala_ksKazuhiro Sera
 
Hadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in ProductionHadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in ProductionDataWorks Summit/Hadoop Summit
 
Cassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupCassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupAdam Hutson
 
Kafka syed academy_v1_introduction
Kafka syed academy_v1_introductionKafka syed academy_v1_introduction
Kafka syed academy_v1_introductionSyed Hadoop
 

Semelhante a Eventual consistency (20)

Building High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaBuilding High Scalability Apps With Terracotta
Building High Scalability Apps With Terracotta
 
Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...
Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...
Change Data Capture (CDC) With Kafka Connect® and the Debezium PostgreSQL Sou...
 
Ozone- Object store for Apache Hadoop
Ozone- Object store for Apache HadoopOzone- Object store for Apache Hadoop
Ozone- Object store for Apache Hadoop
 
All you didn't know about the CAP theorem
All you didn't know about the CAP theoremAll you didn't know about the CAP theorem
All you didn't know about the CAP theorem
 
Freckle
FreckleFreckle
Freckle
 
Memory model
Memory modelMemory model
Memory model
 
Alfresco tuning part2
Alfresco tuning part2Alfresco tuning part2
Alfresco tuning part2
 
Hadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in ProductionHadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in Production
 
The Java Memory Model
The Java Memory ModelThe Java Memory Model
The Java Memory Model
 
Cassandra 2.1 boot camp, Read/Write path
Cassandra 2.1 boot camp, Read/Write pathCassandra 2.1 boot camp, Read/Write path
Cassandra 2.1 boot camp, Read/Write path
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
Hadoop & cloud storage object store integration in production (final)
Hadoop & cloud storage  object store integration in production (final)Hadoop & cloud storage  object store integration in production (final)
Hadoop & cloud storage object store integration in production (final)
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java
 
Elastic search
Elastic searchElastic search
Elastic search
 
SVN session from PiTechnologies
SVN session from PiTechnologies SVN session from PiTechnologies
SVN session from PiTechnologies
 
24 collections framework interview questions
24 collections framework interview questions24 collections framework interview questions
24 collections framework interview questions
 
Future on Servlet #scala_ks
Future on Servlet #scala_ksFuture on Servlet #scala_ks
Future on Servlet #scala_ks
 
Hadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in ProductionHadoop & Cloud Storage: Object Store Integration in Production
Hadoop & Cloud Storage: Object Store Integration in Production
 
Cassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupCassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User Group
 
Kafka syed academy_v1_introduction
Kafka syed academy_v1_introductionKafka syed academy_v1_introduction
Kafka syed academy_v1_introduction
 

Último

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Eventual consistency

  • 1. Terracotta Ehcache Consistency Strong and Eventual Abhishek Sanoujam March 29, 2011
  • 2. Ehcache-2.4 + Terracotta 3.5  Search – http://ehcache.org/documentation/search.html  New Consistency modes – http://ehcache.org/documentation/terracotta/ consistency_options.html  Nonstop feature – http://ehcache.org/documentation/terracotta/non_stop_cache.html  Rejoin  Explicit locking api merged to Ehcache interface  Various other perf improvements and bug fixes – http://ehcache.org Terracotta Ehcache Consistency 2
  • 3. Terracotta Ehcache Consistency Terracotta Ehcache Consistency 3
  • 4. Terracotta Ehcache Consistency  New attribute “consistency” in “terracotta” sub-element of “cache” in ehcache.xml Terracotta Ehcache Consistency 3
  • 5. Terracotta Ehcache Consistency  New attribute “consistency” in “terracotta” sub-element of “cache” in ehcache.xml <cache name=”sampleCache”> <terracotta consistency=”strong|eventual” /> </cache> Terracotta Ehcache Consistency 3
  • 6. Terracotta Ehcache Consistency  New attribute “consistency” in “terracotta” sub-element of “cache” in ehcache.xml <cache name=”sampleCache”> <terracotta consistency=”strong|eventual” /> </cache>  Consistency can be “strong” or “eventual” Terracotta Ehcache Consistency 3
  • 7. Terracotta Ehcache Consistency  New attribute “consistency” in “terracotta” sub-element of “cache” in ehcache.xml <cache name=”sampleCache”> <terracotta consistency=”strong|eventual” /> </cache>  Consistency can be “strong” or “eventual”  Old “coherent” attribute deprecated Terracotta Ehcache Consistency 3
  • 8. Terracotta Ehcache Consistency  New attribute “consistency” in “terracotta” sub-element of “cache” in ehcache.xml <cache name=”sampleCache”> <terracotta consistency=”strong|eventual” /> </cache>  Consistency can be “strong” or “eventual”  Old “coherent” attribute deprecated  With “strong” consistency, changes made by any node in the cluster are visible instantly Terracotta Ehcache Consistency 3
  • 9. Terracotta Ehcache Consistency  New attribute “consistency” in “terracotta” sub-element of “cache” in ehcache.xml <cache name=”sampleCache”> <terracotta consistency=”strong|eventual” /> </cache>  Consistency can be “strong” or “eventual”  Old “coherent” attribute deprecated  With “strong” consistency, changes made by any node in the cluster are visible instantly  With “eventual” consistency, changes made by any node are visible to other nodes eventually Terracotta Ehcache Consistency 3
  • 10. Terracotta Ehcache Consistency  New attribute “consistency” in “terracotta” sub-element of “cache” in ehcache.xml <cache name=”sampleCache”> <terracotta consistency=”strong|eventual” /> </cache>  Consistency can be “strong” or “eventual”  Old “coherent” attribute deprecated  With “strong” consistency, changes made by any node in the cluster are visible instantly  With “eventual” consistency, changes made by any node are visible to other nodes eventually  http://ehcache.org/documentation/terracotta/consistency_options.html Terracotta Ehcache Consistency 3
  • 11. Strong Consistency Terracotta Ehcache Consistency 4
  • 12. Strong Consistency  Changes are visible cluster-wide instantly Terracotta Ehcache Consistency 4
  • 13. Strong Consistency  Changes are visible cluster-wide instantly  Reads/Writes uses clustered locks – Clustered locks same as normal read-write locks, but valid through the cluster – Multiple reads possible – Writes are mutually exclusive to other writes and reads Terracotta Ehcache Consistency 4
  • 14. Strong Consistency  Changes are visible cluster-wide instantly  Reads/Writes uses clustered locks – Clustered locks same as normal read-write locks, but valid through the cluster – Multiple reads possible – Writes are mutually exclusive to other writes and reads  Honors happens-before cluster wide (using clustered locks) Terracotta Ehcache Consistency 4
  • 15. Strong Consistency  Changes are visible cluster-wide instantly  Reads/Writes uses clustered locks – Clustered locks same as normal read-write locks, but valid through the cluster – Multiple reads possible – Writes are mutually exclusive to other writes and reads  Honors happens-before cluster wide (using clustered locks)  Supports other concurrent apis – putIfAbsent(Element element) – removeElement(Element element) – replace(Element element) – replace(Element old, Element element) Terracotta Ehcache Consistency 4
  • 16. Strong Consistency  Changes are visible cluster-wide instantly  Reads/Writes uses clustered locks – Clustered locks same as normal read-write locks, but valid through the cluster – Multiple reads possible – Writes are mutually exclusive to other writes and reads  Honors happens-before cluster wide (using clustered locks)  Supports other concurrent apis – putIfAbsent(Element element) – removeElement(Element element) – replace(Element element) – replace(Element old, Element element)  Works with explicit locking apis Terracotta Ehcache Consistency 4
  • 17. Eventual Consistency Terracotta Ehcache Consistency 5
  • 18. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms) Terracotta Ehcache Consistency 5
  • 19. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms)  L2 notifies clients about which keys were updated Terracotta Ehcache Consistency 5
  • 20. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms)  L2 notifies clients about which keys were updated  On receiving update from L2, those mappings are removed from clients local cache Terracotta Ehcache Consistency 5
  • 21. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms)  L2 notifies clients about which keys were updated  On receiving update from L2, those mappings are removed from clients local cache  Can read stale data for some time (in order of msecs) Terracotta Ehcache Consistency 5
  • 22. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms)  L2 notifies clients about which keys were updated  On receiving update from L2, those mappings are removed from clients local cache  Can read stale data for some time (in order of msecs)  Suitable for apps that can tolerate reading stale data Terracotta Ehcache Consistency 5
  • 23. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms)  L2 notifies clients about which keys were updated  On receiving update from L2, those mappings are removed from clients local cache  Can read stale data for some time (in order of msecs)  Suitable for apps that can tolerate reading stale data  No need of locks for reads/writes – Better performance compared to strong consistency Terracotta Ehcache Consistency 5
  • 24. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms)  L2 notifies clients about which keys were updated  On receiving update from L2, those mappings are removed from clients local cache  Can read stale data for some time (in order of msecs)  Suitable for apps that can tolerate reading stale data  No need of locks for reads/writes – Better performance compared to strong consistency  Supports other concurrent apis – putIfAbsent(Element element) – removeElement(Element element) – replace(Element element) – replace(Element old, Element element) Terracotta Ehcache Consistency 5
  • 25. Eventual Consistency  Changes are visible to other nodes eventually (in order of ms)  L2 notifies clients about which keys were updated  On receiving update from L2, those mappings are removed from clients local cache  Can read stale data for some time (in order of msecs)  Suitable for apps that can tolerate reading stale data  No need of locks for reads/writes – Better performance compared to strong consistency  Supports other concurrent apis – putIfAbsent(Element element) – removeElement(Element element) – replace(Element element) – replace(Element old, Element element)  Works with explicit locking apis – provides more control over locking Terracotta Ehcache Consistency 5
  • 26. Old “coherent” attribute deprecated Terracotta Ehcache Consistency 6
  • 27. Old “coherent” attribute deprecated  Old “coherent” attribute deprecated Terracotta Ehcache Consistency 6
  • 28. Old “coherent” attribute deprecated  Old “coherent” attribute deprecated  coherent=”true” translates to consistency=”strong” Terracotta Ehcache Consistency 6
  • 29. Old “coherent” attribute deprecated  Old “coherent” attribute deprecated  coherent=”true” translates to consistency=”strong”  coherent=”false” translates to consistency=”eventual” Terracotta Ehcache Consistency 6
  • 30. Old “coherent” attribute deprecated  Old “coherent” attribute deprecated  coherent=”true” translates to consistency=”strong”  coherent=”false” translates to consistency=”eventual”  Old coherent=”false” meant bulk-load mode (incoherent mode) – Cannot be set in config (use “eventual” consistency instead) – possible through api only now • setNodeBulkLoadEnabled(true) • setNodeBulkLoadEnabled(false) Terracotta Ehcache Consistency 6
  • 31. Bulk-load mode Terracotta Ehcache Consistency 7
  • 32. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode Terracotta Ehcache Consistency 7
  • 33. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode  No locks are required for reads/writes Terracotta Ehcache Consistency 7
  • 34. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode  No locks are required for reads/writes  Writes are batched heavily in the client (L1) Terracotta Ehcache Consistency 7
  • 35. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode  No locks are required for reads/writes  Writes are batched heavily in the client (L1)  Warmup of large caches happens pretty fast Terracotta Ehcache Consistency 7
  • 36. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode  No locks are required for reads/writes  Writes are batched heavily in the client (L1)  Warmup of large caches happens pretty fast  Once values are fetched, changes/updates by other nodes visible after specific time (5 mins by default) Terracotta Ehcache Consistency 7
  • 37. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode  No locks are required for reads/writes  Writes are batched heavily in the client (L1)  Warmup of large caches happens pretty fast  Once values are fetched, changes/updates by other nodes visible after specific time (5 mins by default)  Possible through api only Terracotta Ehcache Consistency 7
  • 38. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode  No locks are required for reads/writes  Writes are batched heavily in the client (L1)  Warmup of large caches happens pretty fast  Once values are fetched, changes/updates by other nodes visible after specific time (5 mins by default)  Possible through api only  Old api’s are deprecated – setNodeCoherent(boolean coherent) – isNodeCoherent() – isClusterCoherent() – waitUntilClusterCoherent() Terracotta Ehcache Consistency 7
  • 39. Bulk-load mode  coherent=”false” - bulk load mode or incoherent mode  No locks are required for reads/writes  Writes are batched heavily in the client (L1)  Warmup of large caches happens pretty fast  Once values are fetched, changes/updates by other nodes visible after specific time (5 mins by default)  Possible through api only  Old api’s are deprecated – setNodeCoherent(boolean coherent) – isNodeCoherent() – isClusterCoherent() – waitUntilClusterCoherent()  New api’s added in Ehcache interface: – setNodeBulkLoadEnabled(boolean enabledBulkLoad) – isNodeBulkLoadEnabled() – isClusterBulkLoadEnabled() – waitUntilClusterBulkLoadComplete() Terracotta Ehcache Consistency 7
  • 40. How it works - Strong Consistency Terracotta Ehcache Consistency 8
  • 41. How it works - Strong Consistency Terracotta Server Array (L2) Node A Node B Node C (L1) (L1) (L1) Terracotta Ehcache Consistency 8
  • 42. How it works - Strong Consistency Terracotta Server Array (L2) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 8
  • 43. How it works - Strong Consistency Terracotta Server Array (L2) acquireLock (WRITE) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 8
  • 44. How it works - Strong Consistency Terracotta Server Array (L2) acquireLock grant lock (WRITE) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 8
  • 45. How it works - Strong Consistency Terracotta Server Array (L2) acquireLock grant lock (WRITE) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 8
  • 46. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant lock (WRITE) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 8
  • 47. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant lock (WRITE) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) Terracotta Ehcache Consistency 8
  • 48. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant lock (WRITE) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) Terracotta Ehcache Consistency 8
  • 49. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant lock (WRITE) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 50. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant lock (WRITE) put(k1, v1) acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 51. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant lock (WRITE) recall put(k1, v1) acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 52. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant lock (WRITE) recall put(k1, v1) acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 53. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant lock (WRITE) lock recall put(k1, v1) acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 54. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall put(k1, v1) acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 55. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) get(k1) acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 56. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 57. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 58. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 59. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 acquireLock (READ) acquireLock (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 60. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 61. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 62. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 63. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v1 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 64. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 65. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 66. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 67. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 68. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 69. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 70. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 71. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 72. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) acquireLock (READ) acquireLock recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 73. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 v1 put(k1, v2) acquireLock v2 get(k1) (READ) acquireLock v2recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 74. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 v1 put(k1, v2) acquireLock v2 get(k1) (READ) acquireLock v2recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v2) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 75. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 v1 put(k1, v2) acquireLock v2 get(k1) (READ) acquireLock v2recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v2) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 76. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 v1 put(k1, v2) acquireLock v2 get(k1) (READ) acquireLock v2recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v2) (k1, v2) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 8
  • 77. How it works - Strong Consistency Terracotta Server Array (L2) (k1, v2 ) acquireLock grant read grant read grant lock lock (WRITE) lock recall get(k1) put(k1, v1) v1 v1 put(k1, v2) acquireLock v2 get(k1) (READ) acquireLock v2recall recall (READ) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v2) (k1, v2) put(k1, v2) put(k1, v1) get(k1) v2 get(k1) v2 Terracotta Ehcache Consistency 8
  • 78. How it works - Eventual Consistency Terracotta Ehcache Consistency 9
  • 79. How it works - Eventual Consistency Terracotta Server Array (L2) Node A Node B Node C (L1) (L1) (L1) Terracotta Ehcache Consistency 9
  • 80. How it works - Eventual Consistency Terracotta Server Array (L2) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 9
  • 81. How it works - Eventual Consistency Terracotta Server Array (L2) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 9
  • 82. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) put(k1, v1) Terracotta Ehcache Consistency 9
  • 83. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) Terracotta Ehcache Consistency 9
  • 84. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) Terracotta Ehcache Consistency 9
  • 85. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) put(k1, v1) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 86. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) get(k1) put(k1, v1) get(k1) Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 87. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) get(k1) put(k1, v1) v1 get(k1) v1 Node A Node B Node C (L1) (L1) (L1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 88. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) get(k1) put(k1, v1) v1 get(k1) v1 Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 89. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) get(k1) put(k1, v1) v1 get(k1) v1 Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 90. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v1 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 91. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) Node A Node B Node C (L1) (L1) (L1) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 92. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 93. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 94. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) v1 get(k1) Terracotta Ehcache Consistency 9
  • 95. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v1) (k1, v1) put(k1, v2) put(k1, v1) get(k1) v1 get(k1) Terracotta Ehcache Consistency 9
  • 96. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v1) (k1, v1) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 97. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v1) (k1, v1) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 98. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 99. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 100. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 101. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 v2 v2 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 102. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 v2 v2 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v2) (k1, v2) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) Terracotta Ehcache Consistency 9
  • 103. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 v2 v2 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v2) (k1, v2) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) v2 v2 Terracotta Ehcache Consistency 9
  • 104. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 v2 v2 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v2) (k1, v2) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) v2 v2 Terracotta Ehcache Consistency 9
  • 105. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 v2 v2 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v1) (k1, v2) (k1, v2) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) v2 v2 Terracotta Ehcache Consistency 9
  • 106. How it works - Eventual Consistency Terracotta Server Array (L2) (k1, v2 ) get(k1) put(k1, v1) v1 get(k1) v1 put(k1, v2) k1 k1 v2 v2 Node A Node B Node C (L1) (L1) (L1) (k1, v2) (k1, v2) (k1, v2) v1 v1 put(k1, v2) put(k1, v1) get(k1) get(k1) v2 v2 Terracotta Ehcache Consistency 9
  • 107. How it works - Bulk load mode Terracotta Ehcache Consistency 10
  • 108. How it works - Bulk load mode  Similar to eventual consistency – No locks required Terracotta Ehcache Consistency 10
  • 109. How it works - Bulk load mode  Similar to eventual consistency – No locks required  Puts are batched heavily in the L1 Terracotta Ehcache Consistency 10
  • 110. How it works - Bulk load mode  Similar to eventual consistency – No locks required  Puts are batched heavily in the L1  The L2 don’t send out invalidation notifications Terracotta Ehcache Consistency 10
  • 111. How it works - Bulk load mode  Similar to eventual consistency – No locks required  Puts are batched heavily in the L1  The L2 don’t send out invalidation notifications  Invalidations in the local cache happen based on time (5 mins by default) Terracotta Ehcache Consistency 10
  • 112. How it works - Bulk load mode  Similar to eventual consistency – No locks required  Puts are batched heavily in the L1  The L2 don’t send out invalidation notifications  Invalidations in the local cache happen based on time (5 mins by default)  Apps read stale data for the specified time interval – configurable via tc property “ehcache.storageStrategy.dcv2.localcache.incoherentReadTimeout” Terracotta Ehcache Consistency 10
  • 113. Comparison  Strong consistency – Reads/Writes happen under locks – Invalidations of local cache happens when a node acquires WRITE locks  Eventual Consistency – Reads/Writes do not require locks – L2 notifies about changes to interested nodes – L1 invalidates local cache upon receiving notification from L2 – Notifications are batched and sent to only interested nodes  Bulk-load mode – No locks required – Invalidations happen based on time (5 mins by default) – Puts are batched heavily in the L1 Terracotta Ehcache Consistency 11
  • 114. Summary  Strong consistency – Pros • Provides coherent data across the cluster • Changes visible to all nodes instantly • Honors happens-before cluster wide – Cons • If coherent cache not desired, suffers from performance • Needs locks for both reads and writes • May result in lock hopping when data not partitioned leading to perf degradation Terracotta Ehcache Consistency 12
  • 115. Summary Terracotta Ehcache Consistency 13
  • 116. Summary  Eventual Consistency – Pros • No need of locks for reads/writes • Better performance • Changes are visible across cluster in order of ms – Cons • Application can read stale data for some time Terracotta Ehcache Consistency 13
  • 117. Summary  Eventual Consistency – Pros • No need of locks for reads/writes • Better performance • Changes are visible across cluster in order of ms – Cons • Application can read stale data for some time  Bulk Load mode – Pros • No need of locks for reads/writes • Better performance for puts, useful for cache warmup – Cons • Application can read stale data for longer amount of time • Values once fetched, will see changes after specific amount of time Terracotta Ehcache Consistency 13