Apache HBase

Also known as: HBase

On this page 7

Apache HBase is an open-source, distributed wide-column store that runs on top of the Hadoop Distributed File System (HDFS) and provides low-latency random reads and writes to tables with billions of rows and millions of columns. Among database systems, HBase belongs to the NoSQL family and is modeled on the Bigtable design published by Google, with strong per-row consistency instead of relational joins or full SQL.

In the field of databases, HBase is chosen when an application must store very large, sparse datasets and access individual rows by key in milliseconds, while still allowing batch analytics with Hadoop, Spark or MapReduce over the same data.

How Apache HBase stores and serves data

HBase stores data in tables that are sorted lexicographically by row key and split horizontally into contiguous key ranges called regions. Each region is served by exactly one RegionServer, while an active HMaster process assigns regions, handles schema changes and balances load. Coordination state, such as which server is alive and where the metadata table lives, is kept in Apache ZooKeeper in classic deployments.

Writes follow a log-structured merge-tree (LSM tree) path. A mutation is first appended to the write-ahead log (WAL) on HDFS for durability and then placed in an in-memory buffer called the MemStore. When the MemStore reaches its flush threshold, typically 128 MB per column family per region, it is written to disk as an immutable HFile. Background compactions later merge HFiles to limit how many files a read must consult.

Reads combine the MemStore, the BlockCache and the relevant HFiles. Bloom filters stored in each HFile let a RegionServer skip files that cannot contain the requested row, which keeps point lookups fast even when a region holds many files.

The following table summarizes the main components and the role each plays in the read and write path.

ComponentRoleFailure impact
HMasterRegion assignment, DDL, load balancingData path continues; admin operations pause until a standby takes over
RegionServerServes reads and writes for its regionsRegions are reassigned and the WAL is replayed
ZooKeeperLiveness tracking and coordinationCluster cannot detect failures or elect a master
HDFSDurable storage for HFiles and WALData becomes unavailable
hbase:meta tableMaps row-key ranges to regionsClients cannot locate regions
Core components of an HBase cluster

The HBase data model: rows, column families and versions

The HBase data model is a sparse, multidimensional sorted map indexed by row key, column family, column qualifier and timestamp. Only cells that actually hold a value consume space, so a table can have millions of possible columns without wasting storage on empty ones.

Column families must be declared in the schema and are stored in separate files, while column qualifiers are created freely at write time. Storage settings such as compression, block encoding, Bloom filter type and time to live (TTL) apply per column family. Each cell can retain multiple timestamped versions, which supports audit trails and point-in-time reads.

ElementDefined whenTypical use
Row keyAt write timePrimary access path and sort order
Column familyAt table creationGroups columns with shared storage settings
Column qualifierAt write timeIndividual attribute or dynamic column
TimestampAutomatically or by clientVersioning and time-based retention
Cell valueAt write timeUninterpreted byte array
Elements of the HBase data model

Because values are untyped byte arrays, the application or a layer such as Apache Phoenix is responsible for serialization. Guarantees are atomic at the row level: a single row mutation is all-or-nothing, but HBase offers no native multi-row transactions across regions.

How HBase compares with other database systems

HBase is most often compared with Apache Cassandra, ScyllaDB and Amazon DynamoDB, which share the wide-column or key-value approach, and with relational systems such as PostgreSQL. The key differences lie in the consistency model, the storage layer and operational dependencies.

SystemConsistency modelArchitectureQuery interface
Apache HBaseStrong per-row consistencyMaster plus RegionServers on HDFSJava API, REST, Thrift; SQL via Phoenix
Apache CassandraTunable, often eventualMasterless peer-to-peer ringCQL
Amazon DynamoDBEventual or strongly consistent readsFully managed serviceProprietary API, PartiQL
PostgreSQLACID transactionsSingle primary with replicasFull SQL with joins
HBase compared with related systems

The CP orientation of HBase in the CAP sense means that when a RegionServer fails, its regions are briefly unavailable during reassignment rather than serving stale data. Cassandra makes the opposite trade-off, favoring availability.

Designing row keys and tuning HBase in practice

Row key design is the single most important decision in an HBase schema, because the key determines both data locality and load distribution. Monotonically increasing keys such as raw timestamps send all new writes to one region and create a write hotspot. Common remedies are salting with a hash prefix, reversing domain names or identifiers, and composite keys that put a high-cardinality field first.

Operators also pre-split tables into a planned number of regions before bulk loading, keep the number of column families low (usually one to three), and choose compression such as Snappy or ZSTD per family. The decision table below links common workloads to recommended choices.

WorkloadRecommended approachReason
Time-series ingestionSalted prefix plus entity ID plus reversed timeSpreads writes and keeps recent data together
User profile lookupHashed user ID as row keyEven distribution and fast point reads
Large initial importBulk load prepared HFilesBypasses the WAL and MemStore for speed
Short-lived event dataColumn family TTLAutomatic expiry during compaction
SQL access neededApache Phoenix layerAdds secondary indexes and SQL syntax
Design choices for common HBase workloads

Replication between clusters is asynchronous and WAL-based, which supports disaster recovery and read-only analytics clusters, while snapshots allow consistent backups without copying data immediately.

Limitations and common mistakes with HBase

HBase delivers its strengths only at a certain scale, and it carries significant operational complexity. Running it means operating HDFS, ZooKeeper and HBase itself, tuning Java garbage collection and monitoring compaction behavior.

  • Small datasets of a few hundred gigabytes are usually better served by a relational database or a simpler key-value store.
  • No secondary indexes exist natively, so queries not based on the row key require full scans unless Phoenix or a custom index table is used.
  • Major compactions can cause latency spikes and heavy I/O if they run during peak traffic.
  • Too many regions per server, often well above a few hundred, increase memory pressure and slow recovery.
  • Ad hoc analytics over HBase are slow compared with columnar formats such as Parquet or engines such as ClickHouse.

In everyday language

Apache HBase is like a gigantic filing cabinet spread across hundreds of computers. Every folder has a label. The folders are always kept in alphabetical order. Finding one folder takes only a moment, even among billions.

Each folder can hold as many sheets as needed. Empty slots take no space. The key takeaway is simple. HBase is built for fast lookups in enormous collections. It is not meant for complex questions that combine many tables.

Seen in the real world

A telecommunications operator collects network performance counters from about 40,000 cell towers every 15 seconds, which amounts to several billion measurements per day. The engineering team stores them in an HBase table whose row key combines a two-digit salt, the tower identifier and a reversed timestamp, with one column family for metrics and a TTL of 90 days.

Support staff open a dashboard that retrieves the last hour of readings for a single tower in under 50 milliseconds, because the scan touches one narrow key range. At night, a Spark job reads the same table to compute weekly capacity reports. The result is one storage system serving both real-time lookups and batch analytics, with old data removed automatically during compaction.