Skip to content

Add rank examples LAS and EDF, with SP-PIFO and AIFO next to the PIFO - #124

Merged
Mingyumaz merged 1 commit into
feat/pifofrom
feat/pifo-ranks
Dec 1, 2026
Merged

Mingyumaz merged 1 commit into
feat/pifofrom
feat/pifo-ranks

Conversation

@Mingyumaz

Copy link
Copy Markdown
Contributor

Motivation

#123 gives v1model a PIFO per port (ns3::P4PifoScheduler) and one rank example (STFQ). Two questions remain for users: which other rank functions work, and how close does a switch without PIFOs get, with the scheduling approximations that run on today's hardware (SP-PIFO on strict-priority queues, AIFO on one FIFO)? This PR adds two examples that answer both, side by side. It is based on #123 (feat/pifo); please review that first.

What changes

  • p4-pifo-las (least attained service): the rank is the bytes that the packet's TCP flow sent through the switch before it, so short flows pass two long ones without the switch knowing flow sizes. Prints the flow completion times (FCT) of the short flows and the long flows' goodput.
  • p4-pifo-edf (earliest deadline first): the rank is the arrival time plus the deadline of the packet's class (1, 2, 4 ms); three Poisson UDP flows keep a 100 Mbps port 94 % busy. The egress counts the late packets per class.
  • Both build their network four times in one simulation, with the same traffic, and serve the ranks as FIFO, SP-PIFO, AIFO and PIFO. The self-checks compare the four.
  • examples/p4src/pifo_approx/sp_pifo.p4, aifo.p4: SP-PIFO (Alcoz et al., NSDI 2020) and AIFO (Yu et al., SIGCOMM 2021) as P4 controls that any program applies after it has computed the rank; las.p4 and edf.p4 include them. A register approximation switches them on.
  • examples/pifo-example.h: the network, a Poisson source and register access; p4-pifo-stfq uses it now (its output is byte-identical).
  • Docs: examples.md (rows, results tables, references), switch.md (PIFO section), README, TODO.md.

Results (ns-3.39, default arguments):

p4-pifo-las Short flows: mean FCT max Long flows
FIFO 52.5 ms 87 ms 85.1 Mbps
SP-PIFO 5.7 ms 11 ms 85.1 Mbps
AIFO 21.9 ms 214 ms 51.9 Mbps
PIFO 5.7 ms 11 ms 85.2 Mbps

EDF, the class that missed its deadline most: FIFO 23.3 %, SP-PIFO 7.5 %, AIFO 12.6 %, PIFO 1.0 %.

AIFO drops instead of reordering. LAS ranks only grow, so a long flow's own earlier packets look smaller, and AIFO drops the flow, its retransmissions too, once the queue holds more than 1/8 of its capacity; each lost retransmission costs TCP a 200 ms timeout. The docs explain this; it is a property of AIFO with LAS, not a bug I could find.

Scope

  • In: two examples, the SP-PIFO and AIFO P4 controls, the shared example header, docs, two test-list entries (p4-pifo-las --seconds=1, p4-pifo-edf).
  • Out: no change to the simulator itself. PIFO trees (phase 3) come next. AIFO with a sampled or per-flow window is not tried (TODO).
  • Tested (ns-3.39 and ns-3.49, Docker):
    • run-tests.sh passes: 24 suites, 253 cases, 46 example runs; build without warnings.
    • All 44 example runs of Queue schedulers: a P4QueueScheduler module and P4PifoScheduler #123 give the same exit codes, files and output; only the lines with wall-clock times differ. p4-pifo-stfq is byte-identical.
    • Seed sweep, 12 runs of each example per version, all pass. LAS (--seconds=1): the PIFO's mean FCT is 7–17× below the FIFO's (ns-3.49: 10–24×), SP-PIFO's at most 1.2× the PIFO's. EDF: the worst class misses 0–7.9 % with the PIFO, 14–26 % with the FIFO (same on both versions).
    • 9 mutants (SP-PIFO, AIFO, the LAS and EDF ranks, the C++ setup) are all caught by the examples' checks.
    • clang-format clean; the JSON is compiled with p4c 1.2.5.19 (the CI image).
  • Not tested: SP-PIFO and AIFO with other rank functions than LAS and EDF; AIFO with a queue length the ingress sees directly (real hardware may).

Two reviews are needed before merging.

🤖 Generated with Claude Code

p4-pifo-las and p4-pifo-edf build their network four times in one
simulation, with the same traffic, and serve the ranks of the P4 program in
four ways: a FIFO, SP-PIFO on the eight priority queues, AIFO on one FIFO,
and ns3::P4PifoScheduler.

- las.p4: least attained service; the rank is the bytes that the packet's
  TCP flow sent through the switch before it (AIFO's drops do not count).
  Short TCP flows pass two long ones; the example prints their completion
  times.
- edf.p4: earliest deadline first; the rank is the arrival time plus the
  deadline of the packet's class, and the egress counts the late packets
  per class.
- pifo_approx/sp_pifo.p4 and aifo.p4: SP-PIFO (NSDI 2020) and AIFO
  (SIGCOMM 2021) as P4 controls that a program applies once it knows the
  rank and the egress port.
- examples/pifo-example.h: the network, the Poisson source and the register
  access, also used by p4-pifo-stfq now (its output is unchanged).
- Docs: examples.md (rows, results, references), switch.md, README,
  TODO.md; the test list runs both examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Mingyumaz
Mingyumaz merged commit 2560599 into feat/pifo Dec 1, 2026
2 checks passed
Mingyumaz added a commit that referenced this pull request Dec 1, 2026
Add rank examples LAS and EDF, with SP-PIFO and AIFO next to the PIFO (re-land of #124)
@Mingyumaz
Mingyumaz deleted the feat/pifo-ranks branch December 2, 2026 15:17
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.

1 participant