1.2. Timeline and Strong Data Consistency

HBase guarantees timeline consistency for all data served from secondary region servers, meaning all HBase clients see the same data in the same order, but that data may be slightly stale. Only the primary region is guaranteed to have the latest data. Timeline consistency simplifies the programming logic for complex HBase queries and provides lower latency than quorum-based consistency. A query submitted with timeline data consistency is sent to all secondary regions, and the first response is returned to the HBase client. By contrast, strong consistency means that the latest data is always served, but at the cost of increased latency. Strong consistency always directs a query to the primary region. The HBase Java API allows application developers to specify which data consistency is required for a query. See Querying Replicas for more information.

[Note]Note

The HBase API contains a new method,Result.isStale(), to indicate whether the data is returned from a secondary region. However, if the secondary region has already been updated by the primary region server with the latest write operations, then the data is not actually stale.

In the image below, the first HBase client writes data three times to the primary region, which asynchronously replicates each write to two secondary regions. When HBase client 2 requests the value of X with timeline data consistency, the query is sent to all secondary regions. The client receives the data from the secondary region that responds quickest. If the secondary region with replica_id=1 is first to respond, then the client receives 3 as the value. If the secondary region with replica_id=2 reponds first, the client receives 2 as the value because the primary region has not yet replicated the last write operation to that region.


loading table of contents...