Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

17.
Cache Directives
• A cache directive describes a file or directory that
should be cached
• Path
• Cache replication factor: 1-N
• Stored permanently on the NameNode
• Also have cache pools for access control and quotas,
but we won’t be covering that here
17

19.
mlock
• The DataNode pins each cached block into the page
cache using mlock, and checksums it.
• Because we’re using the page cache, the blocks don’t
take up any space on the Java heap.
19
DataNode
Page Cache
DFSClient read
mlock

20.
Zero-copy read API
• Clients can use the zero-copy read API to map the
cached replica into their own address space
• The zero-copy API avoids the overhead of the
read() and pread() system calls
• However, we don’t verify checksums when using the
zero-copy API
• The zero-copy API can be only used on cached data, or
when the application computes its own checksums.
20

26.
Architecture Summary
• The Cache Directive API provides per-file control over
what is cached
• The NameNode tracks cached blocks and coordinates
DataNode cache work
• The DataNodes use mlock to lock page cache blocks
into memory
• The DFSClient can determine whether it is safe to
skip checksums via the shared memory segment
• Caching makes it possible to use the efficient Zero-
Copy API on cached data
26

38.
Microbenchmark Conclusions
• Short-circuit reads need less CPU than TCP reads
• ZCR is even more efficient, because it avoids a copy
• ZCR goes much faster when re-reading the same
data, because it can avoid mmap page faults
• Network and disk may be bottleneck for remote or
uncached reads
38

63.
Impala Conclusions
• HDFS cache is faster than disk or page cache
• ZCR is more efficient than SCR from page cache
• Better when working set is approx. cluster memory
• Can schedule tasks for cache locality
• Significantly better for concurrent workloads
• 7x faster when contending with a single background query
• Impala performance will only improve
• Many CPU improvements on the roadmap
63