-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lock internal and principal keys in RAM (#279)
This commit makes internal and principal keys cache data being locked in RAM to prevent this data from being paged to the swap. For the internal keys, as memory locking is performed in units of whole pages, this commit also redesigns the cache so all records are compactly placed in pages. Before it was a linked list with nodes in random places. So locking each key would mean potential "wasting" of the locked page as its number is limited (although on modern systems it is a fairly big number) and we can't be sure that the next record would be on the same page. Also, having records sequentially placed makes iterations through them CPU cache friendly in contrast to random memory pointers of linked lists. For the principal keys, we just lock the hash table entry. Although it will lock the whole mem page we ok with that potential waste. The number of principal keys should be less than internal and allocated in the shared memory once for all backends (unlike internal keys in the TopMemoryContext of every backend). Plus hash table (via dsa) allocates in 4kb pages and hopefully, principal keys end up compactly placed. Fixes https://perconadev.atlassian.net/browse/PG-823
- Loading branch information
Showing
4 changed files
with
142 additions
and
50 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