Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-8925

Improve lookup performance for the Oracle ObjectId cache when using the Hybrid mining strategy

XMLWordPrintable

      When using the hybrid mining strategy, a cache is used to map object identifiers to specific relational tables in the in-memory relational model. While this cache already maintains a LRU cache of recently looked up entries, this lookup is quite costly, as shown here:

      Benchmark                                        Mode  Cnt     Score    Error   Units
      ObjectIdCacheLookupPerfTest.noPriorResultCache  thrpt   10   468.353 ± 10.631  ops/us
      ObjectIdCacheLookupPerfTest.priorResultCache    thrpt   10  1764.071 ±  3.905  ops/us
      

      I propose we introduce a new member variable that tracks the last objectId and dataObjectId lookup and the resulting TableId. When the cache is consulted, we first check this last value using something like this:

                  if (lastLookup != null &&
                          objectId.equals(lastLookup.objectId()) &&
                          Objects.equals(lastLookup.dataObjectId(), dataObjectId)) {
                      return lastLookup.tableId() == NO_SUCH_TABLE ? null : lastLookup.tableId();
                  }
      

      This avoids the LRUMap lookup all together if the prior lookup was for the same objectId and dataObjectId and clearly provides a 4.5x speed increase based on the current code.

              ccranfor@redhat.com Chris Cranford
              ccranfor@redhat.com Chris Cranford
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: