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

perf(pushsync, retrieval): skiplist prunes items internally on expiration #4001

Merged
merged 14 commits into from
Apr 17, 2023

Conversation

istae
Copy link
Member

@istae istae commented Apr 12, 2023

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

It was identified in a testing session that during uploads, most CPU cycles are wasted on pruning the skiplist.
With this change, the prune call is no longer needed before every push/retrieval.
The clean up call of items is done once at the time of expiration.
Internally, the skiplist now uses a minimum heap to wake up at the time of the closest expiration.

Before

localhost-profile

After

localhost-heap

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@istae istae changed the title perf(pushsync, retrieval): skips prunes items based on item expiration perf(pushsync, retrieval): skiplist prunes items based on item expiration Apr 12, 2023
@istae istae changed the title perf(pushsync, retrieval): skiplist prunes items based on item expiration perf(pushsync, retrieval): skiplist prunes items internally on expiration Apr 12, 2023
@istae istae requested review from a team, aloknerurkar and notanatol and removed request for a team April 13, 2023 12:42
@istae istae marked this pull request as ready for review April 13, 2023 12:42
@istae istae requested a review from mrekucci April 13, 2023 13:00
pkg/node/bootstrap.go Outdated Show resolved Hide resolved
}

// An IntHeap is a min-heap of ints.
type timeHeap []int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good candidate for introducing generics :)

pkg/skippeers/skippeers.go Outdated Show resolved Hide resolved
pkg/skippeers/skippeers.go Outdated Show resolved Hide resolved
pkg/skippeers/skippeers.go Outdated Show resolved Hide resolved
pkg/skippeers/skippeers.go Outdated Show resolved Hide resolved
pkg/skippeers/skippeers.go Outdated Show resolved Hide resolved
pkg/skippeers/skippeers.go Outdated Show resolved Hide resolved
pkg/skippeers/main_test.go Outdated Show resolved Hide resolved
@istae istae merged commit ca43bc5 into master Apr 17, 2023
@istae istae deleted the heap-skiplist branch April 17, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants