-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix write-time optimization for variable expiration (fixes #478)
A high write rate to the same key can overwhelm the write buffer as it may not drop entries and has a maximum capacity. When full this causes backpressure to allow for the mainance task to catch up. A write only needs to be recorded in this buffer when a major event occurs, such as the entry's size changed or expiration time differs. To improve throughput for expireAfterWrite a tolerance of 1s is used to allow for skipping the write buffer and recording into the read buffer instead. This improves throughput by 5x in a same key write benchmark. This optimization was not updated to take into account variable expiration, where the expire time may change based on the calculation determined by configured Expiry. This would cause the entry to not be reordered in the TimerWheel, possibly delaying the automic removal indefinitely. Now when the variable time differs by +/- 1s then the write-time reordering is required. Co-authored-by: Christopher Ng <[email protected]>
- Loading branch information
Showing
4 changed files
with
90 additions
and
7 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
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
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
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