Adaptive Code Cache Sizing via Regeneration Monitoring

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Modern applications with dynamic mechanisms, such as web servers, face challenges in managing memory usage of code caches due to the need for efficient manipulation and optimization, where static tools struggle with runtime behavior and memory constraints.

Innovation Solution

A runtime code manipulation system that automatically adjusts the size of the code cache by removing old entries and adding new ones using an eviction policy, maintaining counts of regenerated and replaced entries, and resizing the cache based on their ratio to optimize memory usage and performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If a hard coded size limit is used for the code cache, then memory usage is controlled, but performance deteriorates due to unnecessary cache flushes and suboptimal cache sizing

Engineering Contradiction:
Improvememory usageVSAvoidperformance
Core Design Contradiction:
Quantity of substanceVSProductivity

Solution Approach 1:

The patent implements dynamic cache sizing where the code cache automatically adjusts its size based on runtime monitoring of regenerated and replaced entries. The cache transitions from a static hard-coded limit to a dynamic structure that adapts to the actual working set of the application, allowing optimal cache size to be determined during execution rather than predetermined.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system monitors cache entry regeneration and replacement events, using this feedback information to determine when and how to resize the code cache. By tracking the ratio of regenerated to replaced entries, the system receives real-time feedback about working set characteristics and adjusts cache size accordingly, eliminating the need for hard-coded limits.

Inventive Principle:
Principle #23Feedback

2Adaptability or versatility

If the code cache size is increased to accommodate more code fragments, then more code can be cached, but memory consumption increases

Engineering Contradiction:
Improvecode caching capabilityVSAvoidmemory consumption
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The code cache size dynamically expands or contracts based on the application's actual needs as measured by regenerated and replaced entry counts. When the working set grows, the cache automatically expands; when it shrinks, the cache contracts, optimizing the balance between code caching capability and memory consumption.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system changes the cache size parameter adaptively based on runtime conditions. By monitoring the ratio of regenerated to replaced entries, the system adjusts the cache capacity parameter to match the actual working set, allowing the cache to accommodate more code when needed while reducing memory usage when the working set is smaller.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If cache entries are frequently evicted to make room for new code, then cache freshness is maintained, but cache utilization decreases

Engineering Contradiction:
Improvecode freshnessVSAvoidcache utilization
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The eviction strategy becomes dynamic rather than static. The system adjusts eviction behavior based on the ratio of regenerated to replaced entries, allowing more aggressive eviction when the working set is large and more conservative eviction when the working set is small, optimizing both freshness and utilization.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The eviction threshold and behavior parameters are changed adaptively based on runtime monitoring. When the ratio of regenerated to replaced entries indicates a large working set, the system adopts more aggressive eviction policies; when the ratio indicates a small working set, the system reduces eviction frequency, thereby improving cache utilization while maintaining freshness.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS7478218B2Adaptive cache sizing based on monitoring of regenerated and replaced cache entries
Publication Date: 2009.01.13 VMWARE INC
  • US7478218B2 patent drawing
  • US7478218B2 patent drawing
  • US7478218B2 patent drawing

AI summary

A runtime code manipulation system is provided that supports code transformations on a program while it executes. The runtime code manipulation system uses code caching technology to provide efficient and comprehensive manipulation of an application running on an operating system and hardware. The code cache includes a system for automatically keeping the code cache at an appropriate size for the current working set of an application running.