Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qd_timer fails to scale efficiently #1155

Open
kgiusti opened this issue Jul 6, 2023 · 0 comments
Open

qd_timer fails to scale efficiently #1155

kgiusti opened this issue Jul 6, 2023 · 0 comments
Assignees

Comments

@kgiusti
Copy link
Contributor

kgiusti commented Jul 6, 2023

The current qd_timer module does not perform well as the number of timers scale.

The primary issue is that the running timers are stored in an sorted linked list. The next timer to expire (shortest time offset) is maintained at the head of the list.

Scheduling a timer involves an O(n/2) scan and sort of the timer list. Adding long-timeout timers result in the pathological case where the entire list is scanned only to insert the timer at the end of the list.

To exacerbate the CPU load the timers use an "offset from previous timer" implementation (rather than a simple deadline timestamp) which requires an additional scan to update the offsets of all the timers that are "past" the newly scheduled timer.

@kgiusti kgiusti added this to the 2.5.0 milestone Jul 6, 2023
@kgiusti kgiusti self-assigned this Jul 6, 2023
@ganeshmurthy ganeshmurthy modified the milestones: 2.5.0, 2.6.0 Nov 2, 2023
@ganeshmurthy ganeshmurthy modified the milestones: 2.6.0, 3.0.0 Mar 27, 2024
@ganeshmurthy ganeshmurthy removed this from the 3.0.0 milestone Sep 12, 2024
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

No branches or pull requests

2 participants