HBase Family Qualifier Settings

Source: Internet
Author: User

HBase table design needs to be changed, so search how to design more reasonable following for the relevant information should know how to design the specific situation

Turn from: http://www.cnblogs.com/shitouer/archive/2012/08/07/2626377.html

Turn from: http://blog.linezing.com/?p=2106

Turn from: http://www.xiaoyaochong.net/wordpress/


The relationship and difference between family and qualifier in table


Like with MySQL, we have to do is table design, MySQL in the table, row, column in the hbase has been different, in the hbase is mainly table and family and qualifier, these three concepts. Table can be directly understood as tables, and family and qualifier can actually be understood as columns, a family can have multiple qualifier below, so it can be simply understood that the column in the HBase is a level two column, that is, family is the first level column, Qualifier is the second-level column. Two are parent-child relationships.


Test discovery:

In the actual scenario, for single column qualifier and multiple column qualifier two cases,

If the length of the value is longer, the shorter the row key length, the smaller the number of fields (column qualifier), and the lower the actual amount of data transferred, and the greater the difference between the former and the latter.

If you store in multiple column qualifier, and the client takes a bulk write, you can increase the client's write buffer size appropriately, in order to improve the writing throughput of the client, depending on the actual situation.


On the setting of family and qualifier in table from the aspect of performance
For a table in a traditional relational database, how to set up family and qualifier from a performance perspective when modeling a business transition to hbase.
Most extreme, ① each column is set to a family,② a table has only one family, all columns are one of them qualifier, so what's the difference?


Consider from the aspect of reading:
The more family, the more obvious the advantage of getting each cell data, because IO and the network are reduced.


If there is only one family, every read will read all the data of the current Rowkey, and there will be some loss on the network and IO.


Of course, if you want to get a fixed number of columns of data, it is better to write these columns in a family than to set family separately, because you can retrieve all the data once you have a request.


From the writing point of view:


First, in terms of memory, for a region, each family of each table is assigned a store, and each store assigns a memstore, so more family consumes more memory.
Second, from flush and compaction, the current version of the HBase, in flush and compaction, is in region, which means that when a family reaches the flush condition, All family belonging to the region will be flush once, even if only a small amount of data in the Memstore will trigger the flush and generate smaller files. This increases the probability that the compaction occurs, and the compaction is also region, which makes it easy to have compaction storms and thus reduce the overall throughput of the system.
Third, consider from the split aspect, because hfile is family, so for multiple family, the data is dispersed to more hfile, reducing the chance of split happening. This is a double-edged sword. Fewer split will cause the region to be larger, because the balance is in the number of region rather than the size, and may cause balance to fail. On the good side, fewer split will allow the system to provide more stable online services. The downside is that we can avoid it by artificially split and balance at the requested trough time.
So for more systems to write, if it is offline should, we try to use only one family good, but if it is online application, it should still be based on the application of the appropriate distribution of family.


First, the different family are under the same region. And each family allocates a memstore, so more family will consume more memory.
Second, the current version of the HBase, in flush and compaction are region units, that is, when a family to reach the flush conditions, the region of all family belong to Memstore will flush once, Small files are generated even if only a very small amount of data in the Memstore triggers the flush. This increases the probability that the compaction occurs, and the compaction is also region, which makes it easy to have compaction storms and thus reduce the overall throughput of the system.
Third, because hfile is family, so for multiple family, the data is dispersed into more hfile, reducing the chance of split. This is a double-edged sword. Fewer split will cause the region to be larger, because the balance is in the number of region rather than the size, and may cause balance to fail. On the good side, fewer split will allow the system to provide more stable online services.
The 3rd benefit is obvious for online applications, and the downside can be avoided by artificially split and balance at the requested trough time.
So for more systems to write, if it is offline should, we try to use only one family good, but if it is online application, it should still be based on the application of the appropriate distribution of family.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.