Closed Cmdv closed 2 weeks ago
These are good results. Are they from runing an epoch? I was wondering if 15000000 is enough for stake_addresses at the tip of the chain (I'll do a full sync so I may have this result). We want to avoid cases that stake_addresses that receive rewards and are used very frequently are evicted from the cache because it's small. Possibly we could also adapt the size of the cache dynamically.
Some nitpicks, which may give us some insight: For stake addresses, misses: 61260 but queries 66.834 and for multiassets, misses: 1099061 and queries: 1,131,696. Do we know which misses we're missing :)?
@kderme With Multi Asset cache all I did was to up the cache capacity from 50000
to 250000
. I've not actually investigating what is happening.
In regards to misses, I have a feeling it's not quite working as expected will double check they are all being marked correctly. As you say the misses and the number of queries the db report should be the same. 5,574
seem to be not marked from the db-sync side 🤔
Description
This fix introduces a reduction in Select queries to the stake address database and instead do them locally in an LRU cache with a size of 1,500,000 entries. This turned out to be a good size to keep RAM usage low yet have a fairly high hit rate. Whilst there I also increased the MultiAsset LRU cache capacity to
250000
which has resulted in.epoch taking around 40 mins to complete syncing down to 10-15mins!!!
New Statistics
The previous cache used which is a
Map
has acache size: 1,273,020
so there is potential of increasing size of new cache.When db-sync is restarted the cache will be populated with the last inserted stake address into the db (using the chosen capacity of the cache).
All newly inserted stake address are inserted into the cache
This fixes #1728