Cache Invalidation via Distributed Soft Lock and Versioning

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In large-scale cloud-based computer systems, concurrent access to cached data objects can lead to a 'stampede' scenario where multiple application threads attempt to reload the same data from the database, wasting resources and causing long wait times due to missing or invalid cached data objects.

Innovation Solution

Implementing a distributed soft lock mechanism within the cache services to arbitrate among parallel application threads, allowing only one thread to reload the data object, and using an extended TTL strategy with versioning data to determine if the cached object is still valid, thereby minimizing database access and optimizing resource usage.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If multiple application threads concurrently access cached data objects, then data access speed is improved, but resource wastage increases due to stampede scenarios

Engineering Contradiction:
Improvedata access speedVSAvoidresource wastage
Core Design Contradiction:
SpeedVSLoss of energy

Solution Approach 1:

A distributed soft lock mechanism is introduced as an intermediary to arbitrate among parallel application threads. The lock acts as a mediator that coordinates access to the cache reload operation, allowing only one thread to execute the reload while others wait, thereby preventing the stampede scenario and reducing resource wastage while maintaining concurrent access capability

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If cached data objects are invalidated frequently, then data consistency is improved, but wait times increase due to repeated reload operations

Engineering Contradiction:
Improvedata consistencyVSAvoidwait times
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

Versioning data is maintained preliminarily alongside cached data objects. When data is updated in the database, the version number is incremented before invalidating the cache. This preliminary action allows the system to quickly determine cache validity without full reload operations, reducing wait times while maintaining data consistency through version comparison

Inventive Principle:
Principle #10Preliminary action

3Reliability

If data objects are reloaded from database, then data freshness is improved, but network and database resource usage increases

Engineering Contradiction:
Improvedata freshnessVSAvoidnetwork and database resource usage
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The system implements feedback through versioning data that tracks database changes. Before reloading data from the database, the system checks the version number against the cached version. This feedback mechanism allows the system to determine whether a reload is necessary, ensuring data freshness only when needed and reducing unnecessary network and database resource usage

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS11010305B2Invalidating cached data objects in write-through operations
Publication Date: 2021.05.18 SALESFORCE INC
  • US11010305B2 patent drawing
  • US11010305B2 patent drawing
  • US11010305B2 patent drawing

AI summary

A request for a write action to be perform a data entity persisted in primary data sources is received. It is determined whether data changes to the data entity are tracked based on an object version key (OVK) definition of a target data object type. If the data changes to the data entity are tracked based on the OVK definition, an OVK key is generated, based on the OVK definition, from data field values specified in the request for the write action. An OVK version number for the data entity is updated, the OVK version number being identified by the OVK key. A cached data object of the target data object type is caused to be invalidated by the updated OVK version number, the cached data object of the target data object type being derived based on underlying data in the data entity persisted in the primary data sources.