forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preallocate the LruCache inside the
TrieCache
and use a Mutex for t…
…rie caches (near#10995) This achieves two distinct things: 1. With the Mutex-based lock around the hashmap of `TrieCache`s we now only hold the lock strictly for as long as necessary, which *may* be as long as it is necessary to create a `TrieCache`, but that's a one-time occurrence outside of resharding scenarios as far as I can tell. 2. With the pre-allocation of the `LruCache` we get rid of the occasionally-very-expensive reallocation of the backing store of this data. --- I haven't been running this code for very long, but these are what the graphs look now (lowpass filter of 5ms for the bottom graph which shows span durations, so for the new graph this means that most of the stuff is under 5ms;; the top graph shows the "current" size of the shard trie caches.) Old(?; I don't actually know what code this node is running): ![image](https://github.com/near/nearcore/assets/679122/6b101adf-f77f-49bc-a188-b11bb784645a) New: ![image](https://github.com/near/nearcore/assets/679122/5b9a9251-9713-403a-9f50-64108f9c29cf) Most notably gone are the occasional blips up-and-above 200ms range per call. Fixes near#10992 --------- Co-authored-by: Bowen Wang <bowen@near.org>
- Loading branch information
1 parent
4fad665
commit 246f7cc
Showing
3 changed files
with
56 additions
and
66 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