SlideShare a Scribd company logo
1 of 52
Download to read offline
Database backed Coherence cache
             Tips, Tricks and Patterns




                        Alexey Ragozin
            alexey.ragozin@gmail.com
                             May 2012
Power of read-write-backing-map

 •   Fetching data as needed
 •   Separation of concerns
 •   Gracefully handling concurrency
 •   Write-behind – removing DB from critical path
 •   Database operation bundling
… and challenges

 DB operations are order of magnitude slower
  • Less deterministic response time
  • Coherence thread pools issues
 How verify persistence with write behind?
 Data are written in DB in random order
 read-write-backing-map and expiry
TIPS
BinaryEntryStore, did you know?

 BinaryEntryStore – an alternative to
 CacheLoader / CacheStore interface.
 Works with BinaryEntry instead of objects.

  You can access binary key and value
    • Skip deserialization, if binary is enough
  You can access previous version of value
    • Distinguish inserts vs. updates
    • Find which fields were cached
  You cannot set entry TTL in cache loader 
When storeAll(…) is called?

 cache.getAll(…)
 • loadAll(…) will be called with partition granularity
   (since Coherence 3.7)
 cache.putAll(…)
 • write-behind scheme will use storeAll(…)
 • write-through scheme will use store(…)
   (this could be really slow)
When storeAll(…) is called?

 cache.invokeAll(…)/aggregate(…)
 • calling get() on entry will invoke load(…)
   (if entry is not cached yet)
 • calling set() on entry will invoke put(…)
   (in case of write-through)
 • you can check entry.isPresent() to avoid needless
   read-through
 • Coherence will never use bulk cache store
   operations for aggregators and entry processors
Warming up aggregator

public static void preloadValuesViaReadThrough(Set<BinaryEntry> entries) {
  CacheMap backingMap = null;
  Set<Object> keys = new HashSet<Object>();
  for (BinaryEntry entry : entries) {
    if (backingMap == null) {
      backingMap = (CacheMap) entry.getBackingMapContext().getBackingMap();
    }
    if (!entry.isPresent()) {
      keys.add(entry.getBinaryKey());
    }
  }
  backingMap.getAll(keys);
}

Code above will force all entries for working set to be
preloaded using bulk loadAll(…).
Call it before processing entries.
Why load(…) is called on write?

 Case:
 • Entry processor is called on set of entries which is
   not in cache and assigns values to them
 Question:
 • Why read-through is triggered?
 Answer:
 • BinaryEntry.setValue(Object) returns old value
 • Use BinaryEntry.setValue(Object, boolean)
Bulk put with write through

You can use same trick for updates.
1. Pack your values in entry processor.
2. In entry processor obtain backing map reference.
3. Call putAll(…) on backing map.
Be careful !!!
• You should only put key for partition entry processor
  was called for.
• Backing map accepts serialized objects.
Using operation bundling
                                          Worker thread 3
            Worker    Worker    Worker                       Cache
                                              RWBM
            thread1   thread2   thread3                      Store

    Req 1

    Req 2




                                                   Waiting
    Req 3
                                                   storeAll()
    Req 1
    Req 2
    Req 3


            Worker    Worker    Worker                       Cache
                                              RWBM
            thread1   thread2   thread3                      Store
Using operation bundling

storeAll(…) with N keys could be called if
 You have at least N concurrent operations
 You have at least N threads in worker pool
  <cachestore-scheme>
      <operation-bundling>
          <bundle-confing>
              <operation-name>store</operation-name>
              <delay-millis>5</delay-millis>
              <thread-threshold>4</thread-threshold>
          </bundle-config>
      </operation-bundling>
  </cachestore-scheme>
Checking STORE decoration

    Configure cache as “write-behind”
    Put data
    Wait until, STORE decoration become TRUE
       (actually it will switch from FALSE to null)
public class StoreFlagExtractor extends AbstractExtractor implements PortableObject {
    // ...
    private Object extractInternal(Binary binValue, BinaryEntry entry) {
        if (ExternalizableHelper.isDecorated(binValue)) {
            Binary store = ExternalizableHelper.getDecoration(binValue, ExternalizableHelper.DECO_STORE);
            if (store != null) {
                Object st = ExternalizableHelper.fromBinary(store, entry.getSerializer());
                return st;
            }
        }
        return Boolean.TRUE;
    }
}
BEHIND SCENES
How it works?

     Distributed cache service




      backing-map
       read-write   Internal map


                    Miss cache


                    Cache store
How it works?
Distribution and backup of data

                                  Distributed cache service

                                                               Storing cache data, expiry



                                  backing-map
                                   read-write   Internal map
                                                               Caching cache loader misses

                                                Miss cache          Interacting with
                                                                   persistent storage
                                                Cache store
             Coordination
How it works?
                        get(key)

                             Distributed cache service

     Cache service
     is receiving
     get(…)
     request.
                            backing-map
                             read-write   Internal map


                                          Miss cache


                                          Cache store




#1
How it works?
                         get(key)

                              Distributed cache service

     Cache service       get(key)
     is invoking
     get(…) on
     backing map.
                             backing-map
                              read-write   Internal map
     Partition
     transaction is
     open.                                 Miss cache


                                           Cache store




#2
How it works?
                         get(key)

                              Distributed cache service

     Backing map         get(key)
     checks internal
     map and miss
     cache if present.
                             backing-map
                              read-write   Internal map
     Key is not found.

                                           Miss cache


                                           Cache store




#3
How it works?
                      get(key)

                           Distributed cache service

     Backing map is   get(key)
     invoking
     load(…) on
     cache loader.
                          backing-map
                           read-write   Internal map


                                        Miss cache


                                        Cache store
                      load(key)



#4
How it works?
                        get(key)

                             Distributed cache service

     Cache loader       get(key)
     is retrieving
     value for
     external
                            backing-map
                             read-write   Internal map
     source

                                          Miss cache


                                          Cache store
                        load(key)

                                   query external data source
#5
How it works?
                       get(key)

                            Distributed cache service

     Value is loaded   get(key)



                           backing-map
                            read-write   Internal map


                                         Miss cache


                                         Cache store
                       load(key)

                                  query external data source
#6
How it works?
                      get(key)

                           Distributed cache service

     Backing map is   get(key)
     updating
     internal map

                          backing-map
                           read-write   Internal map


                                        Miss cache


                                        Cache store
                      load(key)

                                 query external data source
#7
How it works?
                          get(key)

                               Distributed cache service

     Internal map is      get(key)
     observable and                                        map event
     cache service is
     receiving event
                              backing-map
                               read-write   Internal map
     about new entry in
     internal map.
                                            Miss cache


                                            Cache store
                          load(key)

                                     query external data source
#8
How it works?
                       get(key)

                            Distributed cache service

     Call to backing   get(key)
     map returns.                                       map event
     Cache service
     is ready to
                           backing-map
                            read-write   Internal map
     commit
     partition
     transaction.                        Miss cache


                                         Cache store
                       load(key)

                                  query external data source
#9
How it works?
                          get(key)
                                                           update backup
                               Distributed cache service

      Partition           get(key)
      transaction is                                       map event
      being
      committed.
                              backing-map
                               read-write   Internal map
      New value is
      being sent to
      backup node.                          Miss cache


                                            Cache store
                          load(key)

                                     query external data source
#10
How it works?
                        get(key)
                                                         update backup
                             Distributed cache service

      Response for      get(key)
      get(…)                                             map event
      request is sent
      back as backup
                            backing-map
                             read-write   Internal map
      has confirmed
      update.
                                          Miss cache


                                          Cache store
                        load(key)

                                   query external data source
#11
How it works?
                         put(k,v)

                              Distributed cache service

     Cache service
     is receiving
     put(…)
     requiest.
                             backing-map
                              read-write   Internal map


                                           Miss cache


                                           Cache store




#1
How it works?
                          put(k,v)

                               Distributed cache service

     Cache service        put(k,v)
     is invoking
     put(…) on
     backing map.
                              backing-map
                               read-write   Internal map
     Partition
     transaction is
     open.                                  Miss cache


                                            Cache store




#2
How it works?
                        put(k,v)

                             Distributed cache service

     Value is           put(k,v)
     immediately
     stored in
     internal map
                            backing-map
                             read-write   Internal map
     and put to
     write-behind
     queue.                               Miss cache


                                          Cache store




#3
How it works?
                               put(k,v)

                                    Distributed cache service

     Cache service is          put(k,v)                         map event
     receiving event, but                                       DECO_STORE=false
     backing map is
     decorating value with
                                   backing-map
                                    read-write   Internal map
     DECO_STORE=false
     flag to mark that value
     is yet-to-stored.                           Miss cache


                                                 Cache store




#4
How it works?
                       put(k,v)

                            Distributed cache service

     Call to backing   put(k,v)                         map event
     map return.                                        DECO_STORE=false


                           backing-map
                            read-write   Internal map


                                         Miss cache


                                         Cache store




#5
How it works?
                             put(k,v)

                                                                update backup
                                  Distributed cache service

     Partition transaction   put(k,v)                         map event
     is being committed.                                      DECO_STORE=false
     Backup will receive
     value decorated with
                                 backing-map
                                  read-write   Internal map
     DECO_STORE=false.

                                               Miss cache


                                               Cache store




#6
How it works?
                        put(k,v)

                                                           update backup
                             Distributed cache service

     Cache service is   put(k,v)                         map event
     sending response                                    DECO_STORE=false
     back as soon as
     backup is
                            backing-map
                             read-write   Internal map
     confirmed.

                                          Miss cache


                                          Cache store




#7
How it works?
                          put(k,v)

                               Distributed cache service

     Eventually, cache    put(k,v)
     store is called to
     persist value.
     It is done on
                              backing-map
                               read-write   Internal map
     separate thread.

                                            Miss cache


                                            Cache store




#8
How it works?
                       put(k,v)

                            Distributed cache service

     Value is stored   put(k,v)
     in external
     storage by
     cache store.
                           backing-map
                            read-write   Internal map


                                         Miss cache


                                         Cache store


                                  store to external storage
#9
How it works?
                              put(k,v)

                                   Distributed cache service

      Once call to cache      put(k,v)                         map event
      store has returned                                       DECO_STORE=null
      successfully. Backing
      map is removing
                                  backing-map
                                   read-write   Internal map
      DECO_STORE
      decoration from value
      is internal map.                          Miss cache
      Cache service is
      receiving map event
                                                Cache store


                                         store to external storage
#10
How it works?
                                put(k,v)

                                                                  update backup
                                     Distributed cache service

      Map event was             put(k,v)                         map event
      received by cache                                          DECO_STORE=null
      service outside of
      service thread. It will
                                    backing-map
                                     read-write   Internal map
      be put to OOB queue
      and eventually
      processed.                                  Miss cache
      Update to backup will
      be sent once event is
      processed.                                  Cache store


                                           store to external storage
#11
THREADING
Requests and jobs



   Client side:
 One method call



      putAll(…)
Requests and jobs

     Network:
  One request for
   each member


                    PutRequest




     putAll(…)      PutRequest




                    PutRequest
Requests and jobs

    Storage node:
 One job per partition
                                      Job




                         PutRequest   Job




      putAll(…)          PutRequest   Job




                         PutRequest
Requests and jobs

Problem
 Single API call may produce hundreds of jobs
  for worker threads in cluster (limited by
  partition count).
 Write-through and read-through jobs could be
  time consuming.
 While all threads are busy by time consuming
  jobs, cache is unresponsive.
Requests and jobs

Workarounds
 Huge thread pools
 Request throttling
    By member (one network request at time)
    By partitions (one job at time)
 Priorities
    Applicable only to EP and aggregators
“UNBREAKABLE CACHE” PATTERN
“Canary” keys

 Canary keys – special keys (one per partitions)
  ignored by all cache operations.
 Canary key is inserted once “recovery”
  procedure have verified that partition data is
  complete.
 If partition is not yet loaded or lost due to
  disaster, canary key will be missing.
Recovery procedure

 Store object hash code in database
 Using hash you can query database for all keys
  belonging to partition
 Knowing all keys, can use read-through to pull
  data to a cache
 Cache is writable during recovery!
 Coherence internal concurrency control will
  ensure consistency
“Unbreakable cache”

read/write-trough + canary keys + recovery
 Key based operations rely on read-through
 Filter based operations are checking “canary”
  keys (and activate recovery is needed)
 Preloading = recovery
 Cache is writable at all times
Checking “canary” keys

 Option 1
   check “canary” keys
   perform query
 Option 2
   perform query
   check “canary” keys
Checking “canary” keys

 Option 1
   check “canary” keys
   perform query
 Option 2
   perform query
   check “canary” keys
 Right way
   check “canaries” inside of query!
“Unbreakable cache”

Motivation
 Incomplete data set would invalidate hundred of hours of
  number crunching
 100% complete data or exception
 Persistent DB is requirement anyway
Summary
 Transparent recovery (+ preloading for free)
 Always writable (i.e. feeds are not waiting for recovery)
 Graceful degradation of service in case of “disastrous
  conditions”
Thank you
http://blog.ragozin.info
- my articles
http://code.google.com/p/gridkit
- my open source code
                                Alexey Ragozin
                    alexey.ragozin@gmail.com

More Related Content

What's hot

The Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systemsThe Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systemsRomain Jacotin
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsJonas Bonér
 
Hazelcast Deep Dive (Paris JUG-2)
Hazelcast Deep Dive (Paris JUG-2)Hazelcast Deep Dive (Paris JUG-2)
Hazelcast Deep Dive (Paris JUG-2)Emrah Kocaman
 
Elastic HBase on Mesos - HBaseCon 2015
Elastic HBase on Mesos - HBaseCon 2015Elastic HBase on Mesos - HBaseCon 2015
Elastic HBase on Mesos - HBaseCon 2015Cosmin Lehene
 
Geographically Distributed PostgreSQL
Geographically Distributed PostgreSQLGeographically Distributed PostgreSQL
Geographically Distributed PostgreSQLmason_s
 
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...DataStax
 
In-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great TasteIn-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great TasteDataWorks Summit
 
Zero-downtime Hadoop/HBase Cross-datacenter Migration
Zero-downtime Hadoop/HBase Cross-datacenter MigrationZero-downtime Hadoop/HBase Cross-datacenter Migration
Zero-downtime Hadoop/HBase Cross-datacenter MigrationScott Miao
 
HBase Sizing Guide
HBase Sizing GuideHBase Sizing Guide
HBase Sizing Guidelarsgeorge
 
Postgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL ClusterPostgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL ClusterPavan Deolasee
 
HBaseCon 2012 | Base Metrics: What They Mean to You - Cloudera
HBaseCon 2012 | Base Metrics: What They Mean to You - ClouderaHBaseCon 2012 | Base Metrics: What They Mean to You - Cloudera
HBaseCon 2012 | Base Metrics: What They Mean to You - ClouderaCloudera, Inc.
 
Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...
Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...
Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...DataWorks Summit
 
1. beyond mission critical virtualizing big data and hadoop
1. beyond mission critical   virtualizing big data and hadoop1. beyond mission critical   virtualizing big data and hadoop
1. beyond mission critical virtualizing big data and hadoopChiou-Nan Chen
 
Understanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache CassandraUnderstanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache CassandraDataStax
 
Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)
Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)
Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)Spark Summit
 
Hazelcast Jet v0.4 - August 9, 2017
Hazelcast Jet v0.4 - August 9, 2017Hazelcast Jet v0.4 - August 9, 2017
Hazelcast Jet v0.4 - August 9, 2017Rahul Gupta
 

What's hot (20)

The Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systemsThe Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systems
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
Hazelcast Deep Dive (Paris JUG-2)
Hazelcast Deep Dive (Paris JUG-2)Hazelcast Deep Dive (Paris JUG-2)
Hazelcast Deep Dive (Paris JUG-2)
 
Spark Tips & Tricks
Spark Tips & TricksSpark Tips & Tricks
Spark Tips & Tricks
 
Hazelcast 101
Hazelcast 101Hazelcast 101
Hazelcast 101
 
Hazelcast Introduction
Hazelcast IntroductionHazelcast Introduction
Hazelcast Introduction
 
Elastic HBase on Mesos - HBaseCon 2015
Elastic HBase on Mesos - HBaseCon 2015Elastic HBase on Mesos - HBaseCon 2015
Elastic HBase on Mesos - HBaseCon 2015
 
Geographically Distributed PostgreSQL
Geographically Distributed PostgreSQLGeographically Distributed PostgreSQL
Geographically Distributed PostgreSQL
 
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
 
HazelCast
HazelCastHazelCast
HazelCast
 
In-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great TasteIn-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great Taste
 
Zero-downtime Hadoop/HBase Cross-datacenter Migration
Zero-downtime Hadoop/HBase Cross-datacenter MigrationZero-downtime Hadoop/HBase Cross-datacenter Migration
Zero-downtime Hadoop/HBase Cross-datacenter Migration
 
HBase Sizing Guide
HBase Sizing GuideHBase Sizing Guide
HBase Sizing Guide
 
Postgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL ClusterPostgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL Cluster
 
HBaseCon 2012 | Base Metrics: What They Mean to You - Cloudera
HBaseCon 2012 | Base Metrics: What They Mean to You - ClouderaHBaseCon 2012 | Base Metrics: What They Mean to You - Cloudera
HBaseCon 2012 | Base Metrics: What They Mean to You - Cloudera
 
Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...
Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...
Optimizing, profiling and deploying high performance Spark ML and TensorFlow ...
 
1. beyond mission critical virtualizing big data and hadoop
1. beyond mission critical   virtualizing big data and hadoop1. beyond mission critical   virtualizing big data and hadoop
1. beyond mission critical virtualizing big data and hadoop
 
Understanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache CassandraUnderstanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache Cassandra
 
Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)
Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)
Deconstructiong Recommendations on Spark-(Ilya Ganelin, Capital One)
 
Hazelcast Jet v0.4 - August 9, 2017
Hazelcast Jet v0.4 - August 9, 2017Hazelcast Jet v0.4 - August 9, 2017
Hazelcast Jet v0.4 - August 9, 2017
 

Similar to Database backed coherence cache

ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "
ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "
ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "Kuniyasu Suzaki
 
Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsDavide Carnevali
 
EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...
EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...
EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...Kuniyasu Suzaki
 
인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처Jaehong Cheon
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010isnull
 
Rationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoringRationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoringGiulio De Donato
 
Caching principles-solutions
Caching principles-solutionsCaching principles-solutions
Caching principles-solutionspmanvi
 
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management....NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...NETFest
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...Maarten Balliauw
 
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESSpring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESMichael Plöd
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETMaarten Balliauw
 
Heapoff memory wtf
Heapoff memory wtfHeapoff memory wtf
Heapoff memory wtfOlivier Lamy
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012jonswar
 
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Databricks
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7Rahul Gupta
 
Exploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinarExploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinarMaarten Balliauw
 
Compromising Linux Virtual Machines with Debugging Mechanisms
Compromising Linux Virtual Machines with Debugging MechanismsCompromising Linux Virtual Machines with Debugging Mechanisms
Compromising Linux Virtual Machines with Debugging MechanismsRussell Sanford
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayRahul Gupta
 
Windows memory manager internals
Windows memory manager internalsWindows memory manager internals
Windows memory manager internalsSisimon Soman
 
DSL - Domain Specific Languages, Chapter 4, Internal DSL
DSL - Domain Specific Languages,  Chapter 4, Internal DSLDSL - Domain Specific Languages,  Chapter 4, Internal DSL
DSL - Domain Specific Languages, Chapter 4, Internal DSLHiro Yoshioka
 

Similar to Database backed coherence cache (20)

ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "
ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "
ASPLOS2011 workshop RESoLVE "Effect of Disk Prefetching of Guest OS "
 
Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limits
 
EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...
EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...
EuroSec2011 Slide "Memory Deduplication as a Threat to the Guest OS" by Kuniy...
 
인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010
 
Rationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoringRationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoring
 
Caching principles-solutions
Caching principles-solutionsCaching principles-solutions
Caching principles-solutions
 
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management....NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
 
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESSpring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NET
 
Heapoff memory wtf
Heapoff memory wtfHeapoff memory wtf
Heapoff memory wtf
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012
 
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7
 
Exploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinarExploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinar
 
Compromising Linux Virtual Machines with Debugging Mechanisms
Compromising Linux Virtual Machines with Debugging MechanismsCompromising Linux Virtual Machines with Debugging Mechanisms
Compromising Linux Virtual Machines with Debugging Mechanisms
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast Way
 
Windows memory manager internals
Windows memory manager internalsWindows memory manager internals
Windows memory manager internals
 
DSL - Domain Specific Languages, Chapter 4, Internal DSL
DSL - Domain Specific Languages,  Chapter 4, Internal DSLDSL - Domain Specific Languages,  Chapter 4, Internal DSL
DSL - Domain Specific Languages, Chapter 4, Internal DSL
 

More from aragozin

Java on Linux for devs and ops
Java on Linux for devs and opsJava on Linux for devs and ops
Java on Linux for devs and opsaragozin
 
I know why your Java is slow
I know why your Java is slowI know why your Java is slow
I know why your Java is slowaragozin
 
Java profiling Do It Yourself (jug.msk.ru 2016)
Java profiling Do It Yourself (jug.msk.ru 2016)Java profiling Do It Yourself (jug.msk.ru 2016)
Java profiling Do It Yourself (jug.msk.ru 2016)aragozin
 
Java black box profiling JUG.EKB 2016
Java black box profiling JUG.EKB 2016Java black box profiling JUG.EKB 2016
Java black box profiling JUG.EKB 2016aragozin
 
Распределённое нагрузочное тестирование на Java
Распределённое нагрузочное тестирование на JavaРаспределённое нагрузочное тестирование на Java
Распределённое нагрузочное тестирование на Javaaragozin
 
What every Java developer should know about network?
What every Java developer should know about network?What every Java developer should know about network?
What every Java developer should know about network?aragozin
 
Java profiling Do It Yourself
Java profiling Do It YourselfJava profiling Do It Yourself
Java profiling Do It Yourselfaragozin
 
DIY Java Profiler
DIY Java ProfilerDIY Java Profiler
DIY Java Profileraragozin
 
Java black box profiling
Java black box profilingJava black box profiling
Java black box profilingaragozin
 
Блеск и нищета распределённых кэшей
Блеск и нищета распределённых кэшейБлеск и нищета распределённых кэшей
Блеск и нищета распределённых кэшейaragozin
 
JIT compilation in modern platforms – challenges and solutions
JIT compilation in modern platforms – challenges and solutionsJIT compilation in modern platforms – challenges and solutions
JIT compilation in modern platforms – challenges and solutionsaragozin
 
Casual mass parallel computing
Casual mass parallel computingCasual mass parallel computing
Casual mass parallel computingaragozin
 
Nanocloud cloud scale jvm
Nanocloud   cloud scale jvmNanocloud   cloud scale jvm
Nanocloud cloud scale jvmaragozin
 
Java GC tuning and monitoring (by Alexander Ashitkin)
Java GC tuning and monitoring (by Alexander Ashitkin)Java GC tuning and monitoring (by Alexander Ashitkin)
Java GC tuning and monitoring (by Alexander Ashitkin)aragozin
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVMaragozin
 
Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)aragozin
 
Filtering 100M objects in Coherence cache. What can go wrong?
Filtering 100M objects in Coherence cache. What can go wrong?Filtering 100M objects in Coherence cache. What can go wrong?
Filtering 100M objects in Coherence cache. What can go wrong?aragozin
 
Cборка мусора в Java без пауз (HighLoad++ 2013)
Cборка мусора в Java без пауз  (HighLoad++ 2013)Cборка мусора в Java без пауз  (HighLoad++ 2013)
Cборка мусора в Java без пауз (HighLoad++ 2013)aragozin
 
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)aragozin
 
Performance Test Driven Development (CEE SERC 2013 Moscow)
Performance Test Driven Development (CEE SERC 2013 Moscow)Performance Test Driven Development (CEE SERC 2013 Moscow)
Performance Test Driven Development (CEE SERC 2013 Moscow)aragozin
 

More from aragozin (20)

Java on Linux for devs and ops
Java on Linux for devs and opsJava on Linux for devs and ops
Java on Linux for devs and ops
 
I know why your Java is slow
I know why your Java is slowI know why your Java is slow
I know why your Java is slow
 
Java profiling Do It Yourself (jug.msk.ru 2016)
Java profiling Do It Yourself (jug.msk.ru 2016)Java profiling Do It Yourself (jug.msk.ru 2016)
Java profiling Do It Yourself (jug.msk.ru 2016)
 
Java black box profiling JUG.EKB 2016
Java black box profiling JUG.EKB 2016Java black box profiling JUG.EKB 2016
Java black box profiling JUG.EKB 2016
 
Распределённое нагрузочное тестирование на Java
Распределённое нагрузочное тестирование на JavaРаспределённое нагрузочное тестирование на Java
Распределённое нагрузочное тестирование на Java
 
What every Java developer should know about network?
What every Java developer should know about network?What every Java developer should know about network?
What every Java developer should know about network?
 
Java profiling Do It Yourself
Java profiling Do It YourselfJava profiling Do It Yourself
Java profiling Do It Yourself
 
DIY Java Profiler
DIY Java ProfilerDIY Java Profiler
DIY Java Profiler
 
Java black box profiling
Java black box profilingJava black box profiling
Java black box profiling
 
Блеск и нищета распределённых кэшей
Блеск и нищета распределённых кэшейБлеск и нищета распределённых кэшей
Блеск и нищета распределённых кэшей
 
JIT compilation in modern platforms – challenges and solutions
JIT compilation in modern platforms – challenges and solutionsJIT compilation in modern platforms – challenges and solutions
JIT compilation in modern platforms – challenges and solutions
 
Casual mass parallel computing
Casual mass parallel computingCasual mass parallel computing
Casual mass parallel computing
 
Nanocloud cloud scale jvm
Nanocloud   cloud scale jvmNanocloud   cloud scale jvm
Nanocloud cloud scale jvm
 
Java GC tuning and monitoring (by Alexander Ashitkin)
Java GC tuning and monitoring (by Alexander Ashitkin)Java GC tuning and monitoring (by Alexander Ashitkin)
Java GC tuning and monitoring (by Alexander Ashitkin)
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVM
 
Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)
 
Filtering 100M objects in Coherence cache. What can go wrong?
Filtering 100M objects in Coherence cache. What can go wrong?Filtering 100M objects in Coherence cache. What can go wrong?
Filtering 100M objects in Coherence cache. What can go wrong?
 
Cборка мусора в Java без пауз (HighLoad++ 2013)
Cборка мусора в Java без пауз  (HighLoad++ 2013)Cборка мусора в Java без пауз  (HighLoad++ 2013)
Cборка мусора в Java без пауз (HighLoad++ 2013)
 
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
 
Performance Test Driven Development (CEE SERC 2013 Moscow)
Performance Test Driven Development (CEE SERC 2013 Moscow)Performance Test Driven Development (CEE SERC 2013 Moscow)
Performance Test Driven Development (CEE SERC 2013 Moscow)
 

Recently uploaded

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
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
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

Database backed coherence cache

  • 1. Database backed Coherence cache Tips, Tricks and Patterns Alexey Ragozin alexey.ragozin@gmail.com May 2012
  • 2. Power of read-write-backing-map • Fetching data as needed • Separation of concerns • Gracefully handling concurrency • Write-behind – removing DB from critical path • Database operation bundling
  • 3. … and challenges  DB operations are order of magnitude slower • Less deterministic response time • Coherence thread pools issues  How verify persistence with write behind?  Data are written in DB in random order  read-write-backing-map and expiry
  • 5. BinaryEntryStore, did you know? BinaryEntryStore – an alternative to CacheLoader / CacheStore interface. Works with BinaryEntry instead of objects.  You can access binary key and value • Skip deserialization, if binary is enough  You can access previous version of value • Distinguish inserts vs. updates • Find which fields were cached  You cannot set entry TTL in cache loader 
  • 6. When storeAll(…) is called?  cache.getAll(…) • loadAll(…) will be called with partition granularity (since Coherence 3.7)  cache.putAll(…) • write-behind scheme will use storeAll(…) • write-through scheme will use store(…) (this could be really slow)
  • 7. When storeAll(…) is called?  cache.invokeAll(…)/aggregate(…) • calling get() on entry will invoke load(…) (if entry is not cached yet) • calling set() on entry will invoke put(…) (in case of write-through) • you can check entry.isPresent() to avoid needless read-through • Coherence will never use bulk cache store operations for aggregators and entry processors
  • 8. Warming up aggregator public static void preloadValuesViaReadThrough(Set<BinaryEntry> entries) { CacheMap backingMap = null; Set<Object> keys = new HashSet<Object>(); for (BinaryEntry entry : entries) { if (backingMap == null) { backingMap = (CacheMap) entry.getBackingMapContext().getBackingMap(); } if (!entry.isPresent()) { keys.add(entry.getBinaryKey()); } } backingMap.getAll(keys); } Code above will force all entries for working set to be preloaded using bulk loadAll(…). Call it before processing entries.
  • 9. Why load(…) is called on write? Case: • Entry processor is called on set of entries which is not in cache and assigns values to them Question: • Why read-through is triggered? Answer: • BinaryEntry.setValue(Object) returns old value • Use BinaryEntry.setValue(Object, boolean)
  • 10. Bulk put with write through You can use same trick for updates. 1. Pack your values in entry processor. 2. In entry processor obtain backing map reference. 3. Call putAll(…) on backing map. Be careful !!! • You should only put key for partition entry processor was called for. • Backing map accepts serialized objects.
  • 11. Using operation bundling Worker thread 3 Worker Worker Worker Cache RWBM thread1 thread2 thread3 Store Req 1 Req 2 Waiting Req 3 storeAll() Req 1 Req 2 Req 3 Worker Worker Worker Cache RWBM thread1 thread2 thread3 Store
  • 12. Using operation bundling storeAll(…) with N keys could be called if  You have at least N concurrent operations  You have at least N threads in worker pool <cachestore-scheme> <operation-bundling> <bundle-confing> <operation-name>store</operation-name> <delay-millis>5</delay-millis> <thread-threshold>4</thread-threshold> </bundle-config> </operation-bundling> </cachestore-scheme>
  • 13. Checking STORE decoration  Configure cache as “write-behind”  Put data  Wait until, STORE decoration become TRUE (actually it will switch from FALSE to null) public class StoreFlagExtractor extends AbstractExtractor implements PortableObject { // ... private Object extractInternal(Binary binValue, BinaryEntry entry) { if (ExternalizableHelper.isDecorated(binValue)) { Binary store = ExternalizableHelper.getDecoration(binValue, ExternalizableHelper.DECO_STORE); if (store != null) { Object st = ExternalizableHelper.fromBinary(store, entry.getSerializer()); return st; } } return Boolean.TRUE; } }
  • 15. How it works? Distributed cache service backing-map read-write Internal map Miss cache Cache store
  • 16. How it works? Distribution and backup of data Distributed cache service Storing cache data, expiry backing-map read-write Internal map Caching cache loader misses Miss cache Interacting with persistent storage Cache store Coordination
  • 17. How it works? get(key) Distributed cache service Cache service is receiving get(…) request. backing-map read-write Internal map Miss cache Cache store #1
  • 18. How it works? get(key) Distributed cache service Cache service get(key) is invoking get(…) on backing map. backing-map read-write Internal map Partition transaction is open. Miss cache Cache store #2
  • 19. How it works? get(key) Distributed cache service Backing map get(key) checks internal map and miss cache if present. backing-map read-write Internal map Key is not found. Miss cache Cache store #3
  • 20. How it works? get(key) Distributed cache service Backing map is get(key) invoking load(…) on cache loader. backing-map read-write Internal map Miss cache Cache store load(key) #4
  • 21. How it works? get(key) Distributed cache service Cache loader get(key) is retrieving value for external backing-map read-write Internal map source Miss cache Cache store load(key) query external data source #5
  • 22. How it works? get(key) Distributed cache service Value is loaded get(key) backing-map read-write Internal map Miss cache Cache store load(key) query external data source #6
  • 23. How it works? get(key) Distributed cache service Backing map is get(key) updating internal map backing-map read-write Internal map Miss cache Cache store load(key) query external data source #7
  • 24. How it works? get(key) Distributed cache service Internal map is get(key) observable and map event cache service is receiving event backing-map read-write Internal map about new entry in internal map. Miss cache Cache store load(key) query external data source #8
  • 25. How it works? get(key) Distributed cache service Call to backing get(key) map returns. map event Cache service is ready to backing-map read-write Internal map commit partition transaction. Miss cache Cache store load(key) query external data source #9
  • 26. How it works? get(key) update backup Distributed cache service Partition get(key) transaction is map event being committed. backing-map read-write Internal map New value is being sent to backup node. Miss cache Cache store load(key) query external data source #10
  • 27. How it works? get(key) update backup Distributed cache service Response for get(key) get(…) map event request is sent back as backup backing-map read-write Internal map has confirmed update. Miss cache Cache store load(key) query external data source #11
  • 28. How it works? put(k,v) Distributed cache service Cache service is receiving put(…) requiest. backing-map read-write Internal map Miss cache Cache store #1
  • 29. How it works? put(k,v) Distributed cache service Cache service put(k,v) is invoking put(…) on backing map. backing-map read-write Internal map Partition transaction is open. Miss cache Cache store #2
  • 30. How it works? put(k,v) Distributed cache service Value is put(k,v) immediately stored in internal map backing-map read-write Internal map and put to write-behind queue. Miss cache Cache store #3
  • 31. How it works? put(k,v) Distributed cache service Cache service is put(k,v) map event receiving event, but DECO_STORE=false backing map is decorating value with backing-map read-write Internal map DECO_STORE=false flag to mark that value is yet-to-stored. Miss cache Cache store #4
  • 32. How it works? put(k,v) Distributed cache service Call to backing put(k,v) map event map return. DECO_STORE=false backing-map read-write Internal map Miss cache Cache store #5
  • 33. How it works? put(k,v) update backup Distributed cache service Partition transaction put(k,v) map event is being committed. DECO_STORE=false Backup will receive value decorated with backing-map read-write Internal map DECO_STORE=false. Miss cache Cache store #6
  • 34. How it works? put(k,v) update backup Distributed cache service Cache service is put(k,v) map event sending response DECO_STORE=false back as soon as backup is backing-map read-write Internal map confirmed. Miss cache Cache store #7
  • 35. How it works? put(k,v) Distributed cache service Eventually, cache put(k,v) store is called to persist value. It is done on backing-map read-write Internal map separate thread. Miss cache Cache store #8
  • 36. How it works? put(k,v) Distributed cache service Value is stored put(k,v) in external storage by cache store. backing-map read-write Internal map Miss cache Cache store store to external storage #9
  • 37. How it works? put(k,v) Distributed cache service Once call to cache put(k,v) map event store has returned DECO_STORE=null successfully. Backing map is removing backing-map read-write Internal map DECO_STORE decoration from value is internal map. Miss cache Cache service is receiving map event Cache store store to external storage #10
  • 38. How it works? put(k,v) update backup Distributed cache service Map event was put(k,v) map event received by cache DECO_STORE=null service outside of service thread. It will backing-map read-write Internal map be put to OOB queue and eventually processed. Miss cache Update to backup will be sent once event is processed. Cache store store to external storage #11
  • 40. Requests and jobs Client side: One method call putAll(…)
  • 41. Requests and jobs Network: One request for each member PutRequest putAll(…) PutRequest PutRequest
  • 42. Requests and jobs Storage node: One job per partition Job PutRequest Job putAll(…) PutRequest Job PutRequest
  • 43. Requests and jobs Problem  Single API call may produce hundreds of jobs for worker threads in cluster (limited by partition count).  Write-through and read-through jobs could be time consuming.  While all threads are busy by time consuming jobs, cache is unresponsive.
  • 44. Requests and jobs Workarounds  Huge thread pools  Request throttling  By member (one network request at time)  By partitions (one job at time)  Priorities  Applicable only to EP and aggregators
  • 46. “Canary” keys  Canary keys – special keys (one per partitions) ignored by all cache operations.  Canary key is inserted once “recovery” procedure have verified that partition data is complete.  If partition is not yet loaded or lost due to disaster, canary key will be missing.
  • 47. Recovery procedure  Store object hash code in database  Using hash you can query database for all keys belonging to partition  Knowing all keys, can use read-through to pull data to a cache  Cache is writable during recovery!  Coherence internal concurrency control will ensure consistency
  • 48. “Unbreakable cache” read/write-trough + canary keys + recovery  Key based operations rely on read-through  Filter based operations are checking “canary” keys (and activate recovery is needed)  Preloading = recovery  Cache is writable at all times
  • 49. Checking “canary” keys  Option 1  check “canary” keys  perform query  Option 2  perform query  check “canary” keys
  • 50. Checking “canary” keys  Option 1  check “canary” keys  perform query  Option 2  perform query  check “canary” keys  Right way  check “canaries” inside of query!
  • 51. “Unbreakable cache” Motivation  Incomplete data set would invalidate hundred of hours of number crunching  100% complete data or exception  Persistent DB is requirement anyway Summary  Transparent recovery (+ preloading for free)  Always writable (i.e. feeds are not waiting for recovery)  Graceful degradation of service in case of “disastrous conditions”
  • 52. Thank you http://blog.ragozin.info - my articles http://code.google.com/p/gridkit - my open source code Alexey Ragozin alexey.ragozin@gmail.com