Skip to content

Chained caches compound independent hit-rate rolls without key or tier semantics #31

Description

@carlulsoe

What happened

Chaining several generic caches produces a large, mechanically compounded improvement even when the caches have no distinct tier or workload semantics.

Three generic caches independently reducing traffic before an API server and database

The cache behavior performs a fresh independent roll() < hitRate check at every cache and does not use the request key. Consequently, three caches configured for an 80% hit rate behave as three independent miss filters.

I reproduced this directly against dc9c1a07e573da5441c12e1a205ffe8678504dd5, constructing the complete topology before starting the engine so the separate client-generator bug does not affect the result. Averaged over 290 one-second samples:

Client      50.06 RPS
Cache 1     50.06 RPS
Cache 2     10.22 RPS
Cache 3      2.08 RPS
Database     0.36 RPS

This matches 50 * 0.2 * 0.2 * 0.2 = 0.4 RPS, but that result is misleading for generic caches over the same workload. A request reaches cache 2 precisely because it missed cache 1; the caches' hits are not normally independent discounts. The conditional hit rate depends on key popularity, tier capacity, content overlap, admission and eviction policy, and whether these represent browser, edge, regional, or application caches.

I would expect one of the following:

  • cache tiers with explicit, topology-aware semantics over a shared key distribution;
  • a conditional hit-rate model for downstream cache tiers;
  • topology validation that warns about repeated generic caches; or
  • at minimum, a visible assumption that cache hit rates are independent per-hop probabilities and arbitrary stacking can produce unrealistic results.

The current behavior makes it possible to improve a design by adding generic caches indefinitely, teaching the arithmetic of independent filters rather than the tradeoffs of cache hierarchies.

Preset

Custom system

Load

50 RPS on the only client

Browser and OS

Observed in the browser; reproduced independently in the pure simulation engine on Linux.

Anything else

This is separate from the client-generator duplication problem: the cache measurement above starts the engine with the complete topology and never calls setTopology during the run.

The screenshot URL is temporary and expires after 30 days.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:simSimulation engine (src/sim)discussionApproach not settled; open for discussionsim-accuracyA number the simulator shows is wrong or misleading

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions