Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ session outcomes, and embedder refusals inside session outcomes.
- [A/V clock](/quest/m1/av-clock.md) - the audio playhead drives Sync.reference while audio plays, through per-track sync handles
- [Plan: watch worker](/quest/m1/plan-watch-worker.md) - prototype an invisible page worker against app-spawned workers, and land the jank harness that decides
- [Watch worker](/quest/m1/watch-worker.md) - watch playback runs in a worker onto an OffscreenCanvas, so main-thread jank never stalls video or audio
- [Cache expiry growth](/quest/m1/cache-expiry-growth.md) - with the default pool, relay memory plateaus at the expiry window on every version
- [Front deadlines](/quest/m1/front-deadline-index.md) - a front's per-event cost stops growing with its track count: an expiry index and per-track wakes, proven by a churn benchmark
- [io_uring handshake deadline](/quest/m1/listener-deadlines.md) - the io_uring workers apply `listen.timeout` to the handshake
- [HTTP listener deadlines](/quest/m1/listener-deadlines-http.md) - the HTTPS and internal listeners drop a connection with no request in flight for `listen.timeout`
Expand Down
29 changes: 0 additions & 29 deletions quest/m1/cache-expiry-growth.md

This file was deleted.

1 change: 0 additions & 1 deletion quest/m1/cache-max-age.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,5 @@ encoding change; Max Age semantics in the lite draft change.

- [lite-07 Live flag](/quest/m1/lite-live.md) - its untimed `Live` start (the latest group) follows this rule instead: replay what is not stale
- [JS track handover](/quest/m1/js-group-handover.md) - mirrors the failover rule in JS
- [Cache expiry growth](/quest/m1/cache-expiry-growth.md) - relay memory past the expiry window, in the same cache
- [Generated @moq/net](/quest/m1/rs2ts/README.md) - retires js/net's hand-written model
- [FETCH max-delay](/quest/m1/fetch-max-delay.md) - applies the shared rule to historical requests and reconciles native IETF retention clocks
28 changes: 27 additions & 1 deletion rs/moq-net/benches/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
//! route table they occupy, not a publisher writing into its own cache.
//!
//! `SESSION_ALLOCS=1` prints allocations per viewer-group instead of timing.
//! `SESSION_EXPIRY_ONLY=1` uses the standalone 30s-expiry pool and reports groups
//! written plus charged cache bytes every 10s during long profiling runs. Each round
//! advances the cache clock by a second, so the expiry window spans 30 rounds.
//!
//! `session_join_*` times a new viewer connecting, resolving a broadcast, and
//! receiving its latest group, swept over what the relays already announce.
Expand Down Expand Up @@ -282,7 +285,11 @@ impl Cluster {
fn origin(&mut self, capacity: u64) -> (origin::Producer, cache::Pool) {
self.next_hop += 1;
let mut config = origin::Config::new(Hop::new(self.next_hop).unwrap());
let pool = cache::Pool::new(cache::Config::default().with_capacity(capacity));
let pool = cache::Pool::new(if std::env::var_os("SESSION_EXPIRY_ONLY").is_some() {
cache::Config::default().with_expiry(cache::DEFAULT_EXPIRY)
} else {
cache::Config::default().with_capacity(capacity)
});
config.pool = pool.clone();
let (producer, driver) = origin::Producer::new(config);
support::harness::spawn(driver);
Expand Down Expand Up @@ -341,6 +348,8 @@ struct Room {
shape: Shape,
/// Frames written so far, so paced rounds know where each group starts and ends.
written: usize,
/// Groups finished so far across every watched broadcast.
groups: usize,
/// The group each watched broadcast is writing, when paced.
writing: Vec<Option<group::Producer>>,
/// The group each viewer's subscriber is reading, when paced, flattened in viewer order.
Expand Down Expand Up @@ -389,6 +398,7 @@ impl Room {
payload: Bytes::from(vec![0; shape.frame]),
shape,
written: 0,
groups: 0,
writing: Vec::new(),
reading: Vec::new(),
cache_now: moq_net::time::Instant::now(),
Expand Down Expand Up @@ -455,6 +465,7 @@ impl Room {
}
}
assert_eq!(bytes, self.shape.expected());
self.groups += self.shape.burst * self.watched.len();
}

/// One frame into every watched group and one frame out to every viewer, so each
Expand All @@ -471,6 +482,9 @@ impl Room {
*writing = None;
}
}
if last {
self.groups += self.watched.len();
}

let mut bytes = 0;
let subscribers = self.viewers.iter_mut().flat_map(|viewer| &mut viewer.subscribers);
Expand All @@ -492,11 +506,23 @@ impl Room {
/// number of pools, not with the delivery being measured.
async fn measure(&mut self, iters: u64) -> Duration {
let mut elapsed = Duration::ZERO;
let report = std::env::var_os("SESSION_EXPIRY_ONLY").is_some();
let began = Instant::now();
let mut next_report = Duration::from_secs(10);
for _ in 0..iters {
self.tick();
let start = Instant::now();
self.round().await;
elapsed += start.elapsed();
if report && began.elapsed() >= next_report {
eprintln!(
"cache sample: elapsed={:.1}s groups={} charged={}",
began.elapsed().as_secs_f64(),
self.groups,
self.pools().map(cache::Pool::used).sum::<u64>()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Measure RSS before retiring the memory-growth quest

In expiry-only runs this reports only Pool::used, whose documentation explicitly says it is not process RSS. The deleted quest was triggered by RSS continuing to grow and specifically identified groups or allocations outside pool accounting as a possible cause, so this counter can plateau while the original memory regression remains. Sample actual process RSS alongside charged bytes, or retain the quest until the RSS behavior is reproduced.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, so I sampled process RSS externally (ps every 10 s) over a 120 s --profile-time run of the same 4,096-broadcast shape:

Wire RSS 10 / 30 / 60 / 100 s Groups at 100 s Charged at 100 s
lite-06 352 / 351 / 350 / 350 MB 3.51M 2.3 MB
draft-22 613 / 618 / 275 / 148 MB 2.80M 2.3 MB

RSS is flat or falling while groups keep growing, so nothing outside pool accounting is accumulating. I'm keeping RSS out of the bench itself: reading it is platform-specific (/proc vs task_info), and an external ps answers the question without that code.

(Written by Claude Opus 5.5)

);
next_report += Duration::from_secs(10);
}
}
elapsed
}
Expand Down
Loading