Closed wangnengjie closed 5 months ago
I spotted the blob file cache hit rate was low before and didn't dig out the reason. That explains the reason. Thanks for your feedback!
Would you like to fix it? If not, I'll file a PR to fix it.
@Connor1996 hello, i sent a pr to fix this. You can take a moment to look at it. Just a few lines
Defaultly, LRU cache uses a policy
kFullChargeCacheMetadata
which will take memory usage of meta into account. While using it as file cache where we hope 1 file takes only 1 charge, we should use the policykDontChargeCacheMetadata
. Here is where the cache instance of BlobFileCahe is created: https://github.com/tikv/titan/blob/ff85fd19e6268c57b3b01c45aeae011299c1d542/src/blob_file_set.cc#L22-L26Under such setting, each file will be count as 89 charge. In my test case, i set
max_open_files
to 950 so only 10 files can be cached in LRU. Thus most of Get operations need to open a blob file again and again and i observed significant performance degradation.We should use it like this: