Class CacheModel

java.lang.Object
jline.examples.java.basic.CacheModel

public class CacheModel extends Object
Examples of caching models
  • Constructor Details

    • CacheModel

      public CacheModel()
  • Method Details

    • cache_replc_rr

      public static Network cache_replc_rr()
      Basic open cache model with Round Robin (RR) replacement strategy.

      Features: - Cache with 5 items, capacity 2, RR replacement - Three classes: InitClass (requests), HitClass, MissClass - Zipf access pattern with alpha=1.4 (skewed popularity) - Simple Source → Cache → Sink topology - Exponential arrival process with rate 2

      Returns:
      configured cache network model
    • cache_replc_fifo

      public static Network cache_replc_fifo()
      Closed cache model with feedback from hits and misses.

      Features: - Cache with 5 items, capacity 2, FIFO replacement - Closed system with 1 job circulating - Delay node with exponential service (rate 1.0) - Both hits and misses return to delay node as same class - Uniform access pattern across all items

      Returns:
      configured closed cache model
    • cache_replc_routing

      public static Network cache_replc_routing()
      Cache model with multiple delay nodes and random routing.

      Features: - Cache with 5 items, capacity 2, LRU replacement - Router node directing hits/misses to two different delay nodes - Different service rates for hits vs misses at each delay - Random routing strategy for load balancing - Demonstrates cache integration with complex topologies

      Returns:
      configured cache network with routing
    • cache_compare_replc

      public static Network cache_compare_replc()
      Cache model with Zipf access pattern and Round Robin replacement.

      Features: - Cache with 5 items, multi-level capacity [2,1], RR replacement - Zipf distribution for realistic access patterns (skewed popularity) - Alpha parameter controls skewness (1.0 = moderately skewed) - Round Robin replacement strategy instead of FIFO - Exponential arrivals with rate 1

      Returns:
      configured cache model with Zipf access
    • lcq_singlehost

      public static LayeredNetwork lcq_singlehost()
      Layered cache queueing model example 1.

      Features: - Layered network with client processor and cache processor - Client task (T1) with reference scheduling and PS processor - Cache task (C2) with 4 items, capacity 2, Round Robin replacement - Item entry (I2) with uniform access pattern - Activities: A1 (client), AC2 (cache access), AC2h (hit), AC2m (miss) - Cache access precedence with hit and miss paths - LN with MVA backend for solution

      Returns:
      configured layered cache queueing model
    • cache_replc_lru

      public static Network cache_replc_lru()
      Closed cache model with LRU replacement strategy.

      Features: - Cache with 5 items, capacity 2, LRU replacement - Closed system with 1 job circulating - Delay node with exponential service (rate 1.0) - Both hits and misses return to delay node as same class - Uniform access pattern across all items

      Returns:
      configured closed cache model with LRU
    • lcq_threehosts

      public static LayeredNetwork lcq_threehosts()
      Layered cache queueing model example 2 with multi-level cache and downstream service.

      Features: - Layered network with client, cache, and downstream service processors - Client task (T1) with 1 user, reference scheduling - Cache task (CT) with 4 items, multi-level capacity [1,1], Round Robin replacement - Item entry (IE) with uniform access pattern - Downstream service task (T2) with FCFS scheduling and exponential service - Cache miss calls downstream service synchronously - Activities: A1 (client), Ac (cache access), Ac_hit (hit), Ac_miss (miss with service call) - Cache access precedence with hit and miss paths - LN with NC and MVA backends for solution

      Returns:
      configured layered cache queueing model with downstream service
    • lcq_async_prefetch

      public static LayeredNetwork lcq_async_prefetch()
      Layered cache queueing model with asynchronous (non-blocking) cache access.

      Features: - Client makes async call to cache (fire-and-forget, non-blocking) - Client continues immediately without waiting for cache response - Cache still uses POST_CACHE precedence for hit/miss determination - Demonstrates async cache access pattern for prefetching scenarios - Based on lcq_singlehost() but with asynchCall instead of synchCall

      Returns:
      configured layered cache queueing model with async cache access
    • lcq_async_vs_sync_comparison

      public static LayeredNetwork lcq_async_vs_sync_comparison()
      Comparison of synchronous vs asynchronous cache access patterns.

      Creates two models: - Sync version: Client blocks waiting for cache response - Async version: Client continues without waiting (fire-and-forget)

      Use this to compare: - Client response time (async should be lower) - Client throughput (async should be higher) - Cache hit/miss ratios (should be identical)

      Returns:
      configured layered cache queueing model for comparison
    • cache_replc_climb

      public static Network cache_replc_climb()
      Cache with CLIMB (transposition) replacement, closed model over 5 items.

      On a hit an item moves up one position; on a miss it enters at the tail. Exact in CTMC, simulated in SSA/LDES. Not product-form, so MVA/NC/FLD reject it.

      Returns:
      configured cache network model
    • cache_replc_qlru

      public static Network cache_replc_qlru()
      Cache with q-LRU replacement, closed model over 5 items.

      On a miss the item is admitted (LRU head insert) with probability q, otherwise it passes through uncached. Admission filtering can raise the hit ratio over plain LRU under skewed popularity. Exact in CTMC, simulated in SSA/LDES. Not product-form, so MVA/NC/FLD reject it.

      Returns:
      configured cache network model
    • cache_replc_hlru

      public static Network cache_replc_hlru()
      Cache with h-LRU / LRU(m) replacement, open model over 6 items.

      h LRU lists of capacities m[0..h-1]; a miss inserts the item at the head of list 1, a hit in list l exchanges the item with the tail of list l+1. Exact in CTMC, simulated in SSA/LDES; MVA uses the characteristic-time (TTL) approximation of Gast and Van Houdt (SIGMETRICS 2015), which reduces to the Che approximation for h=1.

      Returns:
      configured cache network model
    • cache_itemsize_costcap

      public static Network cache_itemsize_costcap()
      Cache with per-item storage costs (sizes) and per-list cost caps.

      Each item i carries a storage cost sigma_i and list j may hold items of total cost at most k_j. A promotion that would breach a cap serves the request without changing the cache state. SolverNC evaluates the constrained normalizing constant E(m,k) of Casale-Gast (IEEE/ACM ToN 29(2), 2021), Sec. IX; SolverLDES simulates the same rule directly.

      Returns:
      configured cache network model
    • cache_rmf_transient

      public static void cache_rmf_transient()
      Refined mean field (RMF) transient and steady-state analysis of a two-list RANDOM(m) cache, driven through CacheRMF directly.

      Prints the steady-state hit and miss probabilities with the 1/N correction, then the transient evolution X(t) + V(t)/N of the hit rate. This example has no Network: RMF is a mean-field limit of the cache chain, not a queueing model, so there is nothing to hand a solver.

    • cache_mmap_rr_env

      public static Network cache_mmap_rr_env(double lambda1, double lambda2, MarkedMAP mmap)
      MMAP-fed small RR cache with two correlated classes.

      A marked MMPP2 arrival stream feeds a small Round-Robin cache. Its two marks are bound to two open read classes that share the modulating chain, so the classes are cross-correlated and autocorrelated in time, and each reads the cache with a DIFFERENT item popularity. Phase 1 (bursty) emits mostly class-1 references at a high rate, phase 2 (calm) mostly class-2 at a low rate, so the shared chain couples "which class arrives" with "how fast requests arrive".

      Parameters:
      lambda1 - Read1 arrival rate, or a non-positive value to bind the MMAP
      lambda2 - Read2 arrival rate, ignored when the MMAP is bound
      mmap - the marked arrival process, or null for phase-conditional Poisson
      Returns:
      configured cache network model
    • main

      public static void main(String[] args)
      Main method for testing and demonstrating cache model examples.

      Currently configured to: - Set MATLAB-compatible random number generation - Test both regular cache models and layered cache queueing models - Solve using multiple solvers for comparison - Measure and display execution time

      Parameters:
      args - command line arguments (not used)