Skip to content

router: Priority forwarding queues#180

Open
juagargi wants to merge 16 commits intomasterfrom
priority-queue
Open

router: Priority forwarding queues#180
juagargi wants to merge 16 commits intomasterfrom
priority-queue

Conversation

@juagargi
Copy link
Member

@juagargi juagargi commented Feb 2, 2026

This PR introduces priority forwarding queues at the border router.
The main changes are:

  • The Packet data structure now contains a QueueIndex field, that denotes the priority of the packet. It can be set to WithPriority or to WithBestEffort.
  • The existing logic in udpip.go that reads the packets from the packet processor output channel, and sends them via WriteBatch has changed, mainly inside the function readUpTo, where priority packets are always read before anything else.
  • Both the send and readUpTo use now circular iterators (ring buffer iterators). See clarification below.

Because we are now reading from two distinct Go channels (in priority order), the amount of time needed to send N packets with the new feature is greater than before.
To improve performance, circular iterators are used in the function udpConnection.send.
Accompanying benchmarks are in the PR, mainly to ease the discussion on how not to impact performance (too much) while still having priority queues.

This PR had been originally opened as a draft on scionproto#4866


This change is Reviewable

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