Skip to content

feat: first-payload start, ms granularity timestamp alignment, and drift log - #218

Closed
Lethe10137 wants to merge 0 commit into
mainfrom
split/2-trace-start
Closed

Lethe10137 wants to merge 0 commit into
mainfrom
split/2-trace-start

Conversation

@Lethe10137

@Lethe10137 Lethe10137 commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Groups the changes built around the trace start instant (TRACE_START_INSTANT):

  • first-payload (feature first-payload): start traces on the first packet that carries payload, instead of the first packet. Includes fixes so the Bw cell and the token bucket cell honor first-packet / first-payload correctly.
  • mimic mahimahi: a Delay cell mode that mimics mahimahi's behavior, plus assets/mimic_mahimahi.toml and a duration serde helper. It is implemented by align the packet's timestamp to the next ms at the ingress of delay cell. So that, if such delay cell is the last cell before the veth, packets will be sent out in per-ms bursts.
  • drift log (features drift-log, drift-stat): log the trace start time and per-packet time drift in rattan-log, and output drift statistics as .jsonl (adds flowstats). Includes analysis scripts under scripts/ and docs in guide/src/ref/packet-log.md.

Stack (merge in order, rebase-merge; review the diff against the base branch). This is 2/5:

  1. feat(loss): byte trigger for loss cells #217 feat(loss): byte trigger for loss cells
  2. 👉 feat: first-payload start, ms granularity timestamp alignment, and drift log #218 feat: first-payload start, mahimahi-like delay, and drift log
  3. perf(veth): update tokio and reduce ingress overhead #219 perf(veth): update tokio and reduce veth ingress overhead
  4. fix(env): set up netns persist dir once per process #220 fix(env): set up the netns persist directory once per process
  5. refactor(env): make Env generic and move I/O drivers into rattan-env #221 refactor(env): make Env generic and move I/O drivers into rattan-env

🤖 Generated with Claude Code

@BobAnkh BobAnkh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please split this pr into several ones: one PR to netem-trace, one only containing first-payload codes and one only containing drift log. And what is mahimahi-like delay?

Comment thread rattan-core/src/cells/delay.rs Outdated
Comment on lines +22 to +39
struct PeekableDelayTrace {
next: Option<(Delay, Duration)>,
trace: Box<dyn DelayTrace>,
}

impl PeekableDelayTrace {
fn new(mut trace: Box<dyn DelayTrace>) -> Self {
let next = trace.next_delay();
Self { next, trace }
}
fn next_delay(&mut self) -> Option<(Delay, Duration)> {
if let Some(new) = self.trace.next_delay() {
self.next.replace(new)
} else {
self.next
}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should move this to netem-trace instead of here. We should form a new trait or a new wrapper struct

@Lethe10137 Lethe10137 changed the title feat: first-payload start, mahimahi-like delay, and drift log feat: first-payload start, ms granularity timestamp alignment, and drift log Oct 23, 2026
@Lethe10137

Copy link
Copy Markdown
Member Author

Please split this pr into several ones: one PR to netem-trace, one only containing first-payload codes and one only containing drift log. And what is mahimahi-like delay?

Fine. For the "mahimahi-like delay" I meant aligning the packet's timestamp to the next ms at the ingress of a delay cell. So that, if such delay cell is the last cell before the veth, packets will be sent out in per-ms bursts. I changed that to "ms granularity timestamp alignment" -- I'm not sure if that is the correct name for the experimental feature.

@BobAnkh

BobAnkh commented Oct 23, 2026

Copy link
Copy Markdown
Member

Please split this pr into several ones: one PR to netem-trace, one only containing first-payload codes and one only containing drift log. And what is mahimahi-like delay?

Fine. For the "mahimahi-like delay" I meant aligning the packet's timestamp to the next ms at the ingress of a delay cell. So that, if such delay cell is the last cell before the veth, packets will be sent out in per-ms bursts. I changed that to "ms granularity timestamp alignment" -- I'm not sure if that is the correct name for the experimental feature.

@Lethe10137 Yes, that's good, but then please also split it into another PR please. They are three different things.

@Lethe10137

Copy link
Copy Markdown
Member Author

Please split this pr into several ones: one PR to netem-trace, one only containing first-payload codes and one only containing drift log. And what is mahimahi-like delay?

Fine. For the "mahimahi-like delay" I meant aligning the packet's timestamp to the next ms at the ingress of a delay cell. So that, if such delay cell is the last cell before the veth, packets will be sent out in per-ms bursts. I changed that to "ms granularity timestamp alignment" -- I'm not sure if that is the correct name for the experimental feature.

@Lethe10137 Yes, that's good, but then please also split it into another PR please. They are three different things.

I would split this PR in to several stacked PR, i.e. 2a-first-payload, 2b-drift-log, 2c-mimic-mahimahi, after https://github.com/stack-rs/netem-trace/pull/30/changes is merged.

@BobAnkh

BobAnkh commented Oct 23, 2026

Copy link
Copy Markdown
Member

Please split this pr into several ones: one PR to netem-trace, one only containing first-payload codes and one only containing drift log. And what is mahimahi-like delay?

Fine. For the "mahimahi-like delay" I meant aligning the packet's timestamp to the next ms at the ingress of a delay cell. So that, if such delay cell is the last cell before the veth, packets will be sent out in per-ms bursts. I changed that to "ms granularity timestamp alignment" -- I'm not sure if that is the correct name for the experimental feature.

@Lethe10137 Yes, that's good, but then please also split it into another PR please. They are three different things.

I would split this PR in to several stacked PR, i.e. 2a-first-payload, 2b-drift-log, 2c-mimic-mahimahi, after stack-rs/netem-trace#30 (changes) is merged.

The merge of #30 is done, you can do the PR split now

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants