advanced27 min studyLesson 443 in Engineering

Memory interference: capacity limits leave shared traffic

Distinguish resident memory limits, cache allocation, and bandwidth control while measuring the actual hardware domain that tenants share.

On this page

What you’ll understand

  • Explain why a resident-byte cap does not bound memory traffic.
  • Scope Linux resctrl CAT and MBA controls to supported hardware semantics.
  • Interpret a small LRU experiment without treating it as a tenant isolation simulation.

A model-serving process can remain comfortably below its memory capacity limit while streaming enough data to slow another tenant’s decoding. Resident bytes describe stored state; bandwidth describes repeated movement. Cache occupancy, cache replacement, memory-controller contention, and NUMA placement add further dimensions. Linux 6.12 resctrl exposes supported allocation and monitoring features, but their meaning depends on the discovered hardware capabilities and resource domains. A configured percentage is not automatically a measured bandwidth reservation or a confidentiality boundary.

Capacity and traffic are different budgets

A cgroup memory limit constrains accounted memory usage under its hierarchy; it does not directly cap how often the same cache lines are read or written. A small buffer can generate sustained traffic through repeated streaming, and a large mostly idle mapping can generate little traffic. For an inference worker, model weights, key-value cache, and preprocessing buffers have different access patterns. Record data movement and useful work over the same interval rather than infer bandwidth demand from the resident-set graph alone.

NUMA placement and shared last-level cache determine which tenants compete along a path. A remote memory access may stress a different interconnect from a local access, while shared pages and coherence traffic complicate simple byte counters. Monitoring domains also matter: per-socket or per-cache occupancy is not automatically per-request attribution. Establish counter scope, counter update behavior, sampling interval, and workload placement before comparing measurements. A process migration or page-placement change can alter the observed domain without any change to the tenant’s nominal memory limit.

ttransfer≥DBeffectivet_{\rm transfer}\ge\frac{D}{B_{\rm effective}}
D is nonnegative transferred bytes and B is a positive effective bytes-per-second bound for the relevant path. The result is seconds and is only a transfer lower bound under the stated traffic volume, not complete request latency or a guaranteed achieved bandwidth.↔ Scroll wide equations horizontally.

Allocation controls have specific hardware semantics

On supported x86 systems, resctrl cache allocation technology controls eligible cache allocation ways using resource-domain masks. Ordinary shareable groups can have overlapping masks. Exclusive configurations require compatible masks and coordination with the other relevant groups; labeling one group exclusive is not a general proof that all physical interference vanished. Changes govern allocation behavior and do not instantly erase every line a workload previously occupied. Distinguish a mask policy from an observation of current cache contents, and verify what the platform exposes before assuming the feature exists.

Memory bandwidth allocation uses hardware-dependent control semantics; a requested percentage need not translate linearly into an exact number of gigabytes per second. Software feedback modes and the resource domain add their own assumptions. Measure the resulting victim performance and traffic instead of converting a setting directly into a service guarantee. Cache partitioning can reduce a particular eviction interaction while leaving memory buses, shared engines, power effects, or other observation channels shared. Its performance benefit and confidentiality scope therefore require different validation arguments.

Pstream=16gcd⁡(16,s)P_{\rm stream}=\frac{16}{\gcd(16,s)}
This dimensionless period belongs only to the lab stream address(i)=(i s) mod 16, with integer stride s. It is not a hardware cache-set mapping or a resctrl cache-way model.↔ Scroll wide equations horizontally.

Use trace mechanics to separate hypotheses

For a controlled victim, vary one aggressor mechanism at a time: cache-capacity pressure, a streaming bandwidth load, or a coherence-heavy pattern. Measure useful throughput, tail latency, traffic counters, and allocation settings with warmup and repeatable placement. A cache miss is not a fixed-duration event independent of surrounding traffic, so multiplying all misses by one constant can obscure queueing at the memory controller. Preserve both the trace-level explanation and the physical measurements; each rules out different mistaken explanations for the same application slowdown.

Reset the cache lab, explicitly set capacity two and stride four, predict the result after exactly one Step, then Step once. That produces 17 references at t=0.5 and no hits. For a separate comparison Reset, explicitly set capacity four and stride four, predict, and Step once: four cold misses are followed by 13 hits. This empty, fully associative LRU cache has a four-address cycle. It has no second tenant, real replacement policy, NUMA topology, coherence, or CAT masks, so its result teaches reuse rather than certifying hardware partitioning.

An effective bandwidth loss doubles a transfer bound

Assume a hypothetical inference phase must transfer eight decimal gigabytes over one relevant path. Its effective bandwidth ceiling is initially 80 decimal gigabytes per second and falls to 40 under an aggressor. Ignore computation and overlap for this lower-bound calculation.

  1. With eight gigabytes of required movement and an 80-gigabyte-per-second ceiling, the minimum transfer duration is eight divided by 80, or 0.1 seconds. The matching decimal prefixes cancel.

  2. At 40 gigabytes per second, the same volume has a transfer lower bound of 0.2 seconds. The lower bound doubled because the relevant effective bandwidth ceiling halved; the resident memory capacity need not have changed at all.

  3. An observed request can take longer because of compute, synchronization, queueing, remote paths, or additional transfers. Conversely, overlap changes how separate component durations combine. Do not report either lower bound as an end-to-end measured latency or infer an exact resctrl percentage from it.

The result

The traffic path can become the bottleneck without exceeding a resident-byte cap. Attribute the measured bandwidth change before choosing a control.

Explore the model

Interactive lab

Interactive lab · cache

A four-address reuse cycle crosses a capacity boundary

For each run Reset → explicitly set BOTH capacity and stride → predict → Step exactly once. At t=.5, N=17: (C,s)=(2,4) gives 17 misses; Reset plus (4,4) gives four misses and 13 hits. Playback is deterministic LRU, not a co-tenant or CAT experiment.

A four-address reuse cycle crosses a capacity boundaryA fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Current readings: Hits / requests: 0 / 16; Hit rate: 0%; Address-stream period: 16 addresses. All parameters are adjustable with the labeled controls below.Fully associative LRU cache after 16 deterministic requests: 0 hits and 16 misses.Most recent 16 requestsaddress = i × 3 mod 160M3M6M9M12M15M2M5M8M11M14M1M4M7M10M13MCurrent cache order · oldest → newest471013Latest address 13 · miss: inserted as newestToy address stream · period 16 · starts empty
Cached addressMiss / evictionMost recent request
Hits / requests
0 / 16
Hit rate
0%
Address-stream period
16 addresses
t = 0 s

A fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forCapacity relative to reuse changes misses; hardware interference needs separate domain-aware measurements.

Check your understanding

A tenant remains below memory.max but another tenant slows during its streaming scan. Which explanation remains plausible?

Try it yourself

A phase requires six decimal gigabytes of movement. Its measured effective bandwidth ceiling falls from 60 to 30 gigabytes per second. Calculate the two transfer lower bounds. In the lab, would stride four with capacity three hold the entire four-address cycle?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Divide volume by bandwidth, then compare the stream’s reuse period with cache capacity.

Compare with the solution

The lower bounds are 0.1 and 0.2 seconds. They exclude other work and are not complete latency predictions. Stride four has period four in the 16-address toy stream, so capacity three cannot retain the whole cycle under fully associative LRU; every reuse arrives after eviction in this regular sequence. Real cache indexing, replacement, prefetch, shared traffic, and resctrl allocation behavior are absent. Use that result to form a reuse hypothesis, then validate the hardware mechanism using appropriate measurements.

Take it with you

  • Resident capacity does not bound repeated traffic.
  • Discover and measure the exact resctrl hardware domains and semantics.
  • A reuse model explains one mechanism without proving cross-tenant confidentiality.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.