-
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.
The hashtable is being used as a cache for kubernetes metadata and environment variables. The drawback is the hashtable is unbounded and doesn't resize itself. Thus over time it uses more memory and performance becomes worse as the chains get longer. For Kubernetes this can be particularly bad in busy environments as the cache key uses podname, which will change every time a deployment occurs. By bounding the hashtable we ensure memory doesn't become unbounded and performance remains constant. For a cache it should be okay to evict old entries. This implementation tries to keep things simple by performing eviction on adding a key to the table. As long as the hashtable size isn't exceeded, the behaviour remains the same as before - the table is looked up via hash function, and the table chain is extended. When the hashtable size is exceeded, the housekeeping will remove all prior keys in a random chain to bring down the hashtable size. The advantage of a random eviction is it's simple and fast versus constructing an LRU list (or something else).
- Loading branch information
James Ravn
committed
Nov 20, 2017
1 parent
00b173a
commit 60c68c8
Showing
5 changed files
with
75 additions
and
20 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
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