hudi
hudi copied to clipboard
Added BlockCache to HFile reader.
Change Logs
HBase 2.4+ does not allocate a block cache automatically within the CacheConfig but requires a BlockCache instance to be passed in. This is different from HBase 1.x where CacheConfig allocated and used a static global BlockCache instance.
BlockCache speeds up lookup from the HFile. To emulate the behavior of
HBase 1.x, we will allocate a global static global block cache here if
it is enabled. The BlockCache can be controlle via hfile configs passed
via hadoop configuration to the process.
https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java
Logs which show BlockCache was allocated
[Driver] BlockCacheFactory: Allocating BlockCache size=3.20 GB, blockSize=64 KB
[Driver] HoodieAvroHFileReader: Allocated a new global block cache for hfile readers LruBlockCache{blockCount=0, currentSize=2.40 MB, freeSize=3.20 GB, maxSize=3.20 GB, heapSize=2.40 MB, minSize=3.04 GB, minFactor=0.95, multiSize=1.52 GB, multiFactor=0.5, singleSize=778.24 MB,
singleFactor=0.25}
Test Plan:
Tested using a perf tool to lookup 10K keys from RI. With BlockCache enabled, the time is 4x less.
With BlockCache:
[Driver] HoodieRecordIndexPerf: Time to lookup 10000 existing keys: 204462
[Driver] HoodieRecordIndexPerf: Time to lookup 10000 missing keys: 95169
Without BlockCache:
[Driver] HoodieRecordIndexPerf: Time to lookup 10000 existing keys: 817908
[Driver] HoodieRecordIndexPerf: Time to lookup 10000 missing keys: 93470
Impact
Lookups from MDT partitions like RI can be faster.
Risk level (write none, low medium or high below)
If medium or high, explain what verification was done to mitigate the risks.
Documentation Update
Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".
- The config description must be updated if new configs are added or the default value of the configs are changed
- Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the ticket number here and follow the instruction to make changes to the website.
Contributor's checklist
- [ ] Read through contributor's guide
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
CI report:
- 7c8a92aedbc68cd19d1377374d4fb097d5859bd3 Azure: FAILURE
Bot commands
@hudi-bot supports the following commands:-
@hudi-bot run azurere-run the last Azure build
hey @rmahindra : can you take a first stab on reviewing this patch