cucapra / packet-scheduling

MIT License
3 stars 0 forks source link

Is `WFQ` agnostic to packet features? #52

Open polybeandip opened 3 months ago

polybeandip commented 3 months ago

pifo-tree-artifact has a scheduling transaction for WFQ on a ternary tree: Node(✻, ✻, ✻).

let wfq_helper s weight var_last_finish pkt_len time : Rank.t * State.t =
  (* The WFQ-style algorithms have a common pattern,
      so we lift it into this helper method.
  *)
  let rank =
    if State.isdefined var_last_finish s then
      max (Time.to_float time) (State.lookup var_last_finish s)
    else Time.to_float time
  in
  let s' = State.rebind var_last_finish (rank +. (pkt_len /. weight)) s in
  (Rank.create rank time, s')

let scheduling_transaction s pkt =
  let time = Packet.time pkt in
  let flow = Packet.find_flow pkt in
  let var_last_finish = Printf.sprintf "%s_last_finish" (Flow.to_string flow) in
  let var_weight = Printf.sprintf "%s_weight" (Flow.to_string flow) in
  let weight = State.lookup var_weight s in
  let rank_for_root, s' =
    wfq_helper s weight var_last_finish (Packet.len pkt) time
  in
  let int_for_root =
    (* Put flow A into leaf 0, flow B into leaf 1, and flow C into leaf 2. *)
    match flow with
    | A -> 0
    | B -> 1
    | C -> 2
    | n -> failwith Printf.(sprintf "Don't know how to route flow %s." (Flow.to_string n))
  in
  ([ (int_for_root, rank_for_root); (0, Rank.create 0.0 time) ], s')

In particular, notice our algorithm uses Packet.len pkt (i.e. pkt_len in wfq_helper) to update var_last_finish in our state.

This is in contradiction of the entry for WFQ in our glossary of scheduling policies since the glossary says

Agnostic to packets' own features, but accepts user-set weights for prioritizing classes of packets.

anshumanmohan commented 3 months ago

Good catch, thanks. Let's update either the code or the glossary. Probably the easy/safe move is to review Demers et al, SIGCOMM '89, see what they do, and run with that. A slightly better move would be to investigate what WFQ has come to mean since Demers' paper in 1989! And cite that and run with that.