• HBase HFile


    HFile index

    HFile index, which is proportional to the total number of Data Blocks. The total amount of memory needed to hold the index can be estimated as (56+AvgKeySize)*NumBlocks.

    HFile的索引记录数量是与HFile所包含的Data Block数目成正比的。整个索引所需要的内存空间大约是(56+AvgKeySize)*NumBlocks。

    Suggestions on performance optimization
    Minimum block size. We recommend a setting of minimum block size between 8KB to 1MB for general usage. Larger block size is preferred if files are primarily for sequential access. However, it would lead to inefficient random access (because there are more data to decompress). Smaller blocks are good for random access, but require more memory to hold the block index, and may be slower to create (because we must flush the compressor stream at the conclusion of each data block, which leads to an FS I/O flush). Further, due to the internal caching in Compression codec, the smallest possible block size would be around 20KB-30KB.

    在一般的使用场景中推荐将HBase Data Block的大小设置为8KB到1MB之间。

    如果顺序访问的场景居多,可以将Data Block的大小调大,但是这会导致HBase随机访问效率低下,因为需要对更多的数据进行解压。

    小一点的Data Block非常有利于HBase的随机访问,但是需要消耗更多的内存来维护索引记录;在创建这些Data Block的时候也会比较慢,因为我们需要在每一个Data Block被写满之后对其进行Flush,这会导致低层HDFS的I/O Flush。而且,由于一些压缩库在使用时内部会包含一些Cache,所以Data Block的大小最好控制在20KB到30KB之间。

    HFile Format

    image_thumb6

    File is made of data blocks followed by meta data blocks (if any), a fileinfo block, data block index, meta data block index, and a fixed size trailer which records the offsets at which file changes content type.

     <data blocks><meta blocks><fileinfo><data index><meta index><trailer>
     
    Each block has a bit of magic at its start. Block are comprised of key/values. In data blocks, they are both byte arrays. Metadata blocks are a String key and a byte array value. An empty file looks like this:
     <fileinfo><trailer>
     
    That is, there are not data nor meta blocks present.
  • 相关阅读:
    并发下常见的加锁及锁的PHP具体实现代码(转)
    Yii2.0高级框架数据库增删改查的一些操作(转)
    MySQL主从数据库同步延迟问题解决(转)
    Redis安装及主从配置(转)
    Sphinx 之 Coreseek、Sphinx-for-chinaese、Sphinx+Scws 评测
    Sphinx中文分词安装配置及API调用
    php实现二分查找法
    PHP设计模式_适配器模式
    PHP设计模式_注册树模式
    PHP设计模式_工厂模式
  • 原文地址:https://www.cnblogs.com/yurunmiao/p/3520079.html
Copyright © 2020-2023  润新知