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
    • 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)