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

aio expiration list performance work needed #1488

Closed
gdamore opened this issue Aug 9, 2021 · 0 comments
Closed

aio expiration list performance work needed #1488

gdamore opened this issue Aug 9, 2021 · 0 comments

Comments

@gdamore
Copy link
Contributor

gdamore commented Aug 9, 2021

The fix for #1449 was unfortunately not quite complete, and introduced a regression. See #1486.

While the regression is now fixed, we are leaving a lot of performance on the table, and have regressed back to O(n^2) on the expiration list.

The conversion to an array should be changed to retain the index so that during removal we can recover the slot without having to look for it. As this is the hot code path, this will save a lot of cycles.

Additionally we need to keep the "next expiration time" in a per expiration queue variable, so that we can avoid waking up the expiration loop unless that loop needs to be woken for rescheduling because the newly inserted item expires sooner than any other item on the array (or is the only item on the array).

JaylinYu pushed a commit to nanomq/nng that referenced this issue Aug 11, 2021
There were several problems with the array implementation, both
from performance and from correctness.  This corrects those errors
(hopefully) and restores the expiration lists as linked lists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant