forked from orijtech/groupcache
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hot/candidate cache: remove damping on key qps
The damping was a bit problematic in that it prevented any hits less than a second after the initial candidate-cache insertion from having a non-zero qps calculated. In this new windowed-QPS type, we specifically avoid including a time.Time so there are no pointers for the Garbage Collector to scan. As such, we now measure time relative to a new `baseTime` in the Galaxy. To facilitate testing, time is now managed by an implementation of the go-clocks package's Clock interface. Additionally, this has a few other properties: - After some time a value is considered "stale" and reset. (so as not to penalize a key that's hung in the candidate cache for hours relative to one that's been evicted and brought back) - QPS is calculated relative to the current "epoch" for that key (which is either the creation time or the last time it was reset due to staleness. To facilitate a simpler Promoter implementation, we add a Hits field that's guaranteed to be 0 on the first fetch.
- Loading branch information
Showing
6 changed files
with
296 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.