Skip to content

Introduce dual-queue backed queue for the Affinity scheduler - #310

Merged
Dueris merged 9 commits into
mainfrom
dev/affinity-dual-queue
Aug 11, 2026
Merged

Introduce dual-queue backed queue for the Affinity scheduler#310
Dueris merged 9 commits into
mainfrom
dev/affinity-dual-queue

Conversation

@Dueris

@Dueris Dueris commented Aug 1, 2026

Copy link
Copy Markdown
Member

Original concept idea created by Jan.

This concept essentially introduces a 2nd priority queue ordered by the last insertion time, which is used later on to process intermediate tasks if the current tick we are waiting for does not have tasks to process. This improves efficiency of the scheduler and intermediate tasks, reducing latency of packet processing, chunk tasks, and tick tasks in the region.

The new queue implementation is the SchedulableTickFastQueue, which is backed by 2 FastHeapPriorityQueue instances, edf and queueTime. edf is ordered by EDF(earliest deadline first), maintaining the queue order for what tick needs to be processed next. queueTime is ordered by the insertion time of the schedulable tick into the EDF queue, with the head always being the task that was inserted the longest time ago.

This should prove to be very useful and powerful for a lot of servers. Further optimizations will be done down the line to try and maximize the time spent processing intermediate tasks through load balancing optimizations that will be done at a later date.

This marks this panel task as in-progress

…ermediate task processing

Original concept idea created by Jan.

This concept essentially introduces a 2nd priority queue ordered by the last insertion time, which is used later on to process intermediate tasks if the current tick we are waiting for does not have tasks to process. This improves efficiency of the scheduler and intermediate tasks, reducing latency of packet processing, chunk tasks, and tick tasks in the region.

The new queue implementation is the SchedulableTickFastQueue, which is backed by 2 FastHeapPriorityQueue instances, "edf" and "queueTime". "edf" is ordered by EDF(earliest deadline first), maintaining the queue order for what tick needs to be processed next. "queueTime" is ordered by the insertion time of the schedulable tick into the EDF queue, with the head always being the task that was inserted the longest time ago.

This should prove to be very useful and powerful for a lot of servers. Further optimizations will be done down the line to try and maximize the time spent processing intermediate tasks through load balancing optimizations that will be done at a later date.
@Dueris
Dueris requested review from a team August 1, 2026 01:25
@Dueris Dueris added enhancement New feature or request performance Related to a performance enhancement or performance issue or question priority: medium status: waiting for review Waiting for review from an official member of the team labels Aug 1, 2026
@devnootnoot

Copy link
Copy Markdown
Contributor

yep, loved the original idea by Jan, looks like it's implemented nicely

@devnootnoot
devnootnoot self-requested a review August 10, 2026 19:00
@Dueris
Dueris merged commit d5ee409 into main Aug 11, 2026
1 check passed
@Dueris
Dueris deleted the dev/affinity-dual-queue branch August 11, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request performance Related to a performance enhancement or performance issue or question priority: medium status: waiting for review Waiting for review from an official member of the team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants