Multi-lock Cache Contention Reduction via Segmentation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Caching systems face inefficiencies due to limited storage capacity in faster memory types, leading to increased CPU delays and reduced performance from cache misses, as not all data can be stored in the cache, resulting in higher access times and reduced system performance.

Innovation Solution

Implementing a caching system that uses fixed-size storage blocks to increase memory efficiency, reduces fragmentation, and employs multiple locks to decrease contention in multi-threaded systems, along with a snapshot file to persistently store frequently accessed data for quick recovery and repopulation of the cache.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If cache size is increased to store more data items, then cache hit rate is improved, but memory cost and access time increase due to using faster but smaller and more expensive memory types

Engineering Contradiction:
Improvecache hit rateVSAvoidcache storage capacity
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The cache is divided into multiple regions or sets, each managed independently with its own lock. This segmentation allows parallel access to different cache regions by multiple threads, improving throughput and reducing contention while maintaining overall cache capacity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a hierarchical locking mechanism with multiple levels (e.g., set locks, way locks, entry locks) rather than a single lock dimension. This multi-dimensional approach allows finer-grained control over cache access, enabling better concurrency while maintaining data integrity.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Reliability

If single lock is used to protect cache data, then data consistency is maintained, but contention increases in multi-threaded systems reducing performance

Engineering Contradiction:
Improvedata consistencyVSAvoidmulti-threaded performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The cache is divided into multiple regions or sets, each managed independently with its own lock. This segmentation allows parallel access to different cache regions by multiple threads, improving throughput and reducing contention while maintaining overall cache capacity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The locking mechanism dynamically adapts to the access pattern by allowing read operations to acquire shared locks that permit concurrent reads, while write operations acquire exclusive locks. This dynamic locking strategy optimizes performance based on the operation type.

Inventive Principle:
Principle #15Dynamics

3Quantity of substance

If variable-size storage blocks are used to optimize data storage, then storage efficiency is improved, but memory fragmentation increases reducing overall cache utilization

Engineering Contradiction:
Improvestorage efficiencyVSAvoidmemory fragmentation
Core Design Contradiction:
Quantity of substanceVSStability of the object's composition

Solution Approach 1:

The cache uses fixed-size storage blocks or cache lines throughout the structure. This homogeneity simplifies memory management, eliminates fragmentation issues, and enables efficient use of the cache space through uniform allocation and deallocation patterns.

Inventive Principle:
Principle #33Homogeneity

4Reliability

If cache is repopulated from bulk storage after crash, then data availability is restored, but system performance degrades due to slow access to bulk storage

Engineering Contradiction:
Improvedata availabilityVSAvoidcache recovery time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs preliminary actions by writing cache data to a log or snapshot file in advance before potential crashes. Upon recovery, this pre-written data is quickly loaded back into the cache, avoiding the need to read from slow bulk storage and significantly reducing recovery time.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10176057B2Multi-lock caches
Publication Date: 2019.01.08 AMAZON TECH INC
  • US10176057B2 patent drawing
  • US10176057B2 patent drawing
  • US10176057B2 patent drawing

AI summary

Processes are disclosed for decreasing contention in caches in order to increase the efficiency of multi-threaded or multi-processor systems. By using multiple locks in a cache, smaller portions of the cache can be locked during cache updates (e.g., during a data update or a storage block eviction). As only small portions of the cache are locked at any given time, contention between threads, particularly in multi-processor implementations, will likely be reduced. For example, if different threads are trying to update different entries in the cache, the threads can proceed with updating the cache concurrently.