Skip to main content

Tuning HBase GC: CMS vs ParallelGC and MSLAB

Struggling with delivery, architecture alignment, or platform stability?

I help teams fix systemic engineering issues: processes, architecture, and clarity.
→ See how I work with teams.


This short guide explains how legacy HBase clusters were tuned with JVM options for CMS and ParallelGC and how MemStore-Local Allocation Buffers (MSLAB) help reduce GC pauses caused by old-generation fragmentation. Use this as a reference if you still run JDK7/8-based HBase 0.92-era installations or are migrating them, not as guidance for modern Java and HBase versions.

Note (2025): The GC flags in this article apply to older Java 7/8 HBase deployments where CMS and ParallelGC were common choices. In newer JVMs, the Concurrent Mark-Sweep (CMS) collector is deprecated and removed in favour of collectors like G1GC. Treat the configuration below as legacy tuning for old HBase stacks, not as recommendations for new clusters.

Why HBase GC tuning mattered so much

HBase region servers keep a lot of data in memory (memstores and block cache). Without careful JVM tuning, garbage collection can easily cause long pauses, region server timeouts and client-visible outages. Adjusting HBASE_OPTS was therefore a necessary step to get acceptable performance and stability in larger installations.

Example JVM options for HBase

A common CMS-based tuning for HBase region servers looked like this:

HBASE_OPTS="-XX:+UseParNewGC \
  -XX:+UseConcMarkSweepGC \
  -XX:CMSInitiatingOccupancyFraction=70 \
  -XX:+CMSParallelRemarkEnabled"

An alternative setup used the throughput-focused ParallelGC:

HBASE_OPTS="-server \
  -XX:+UseParallelGC \
  -XX:+UseParallelOldGC \
  -XX:ParallelGCThreads=8"

Both approaches were used successfully in production, but the trade-offs are quite different.

CMS vs ParallelGC for HBase

Concurrent Mark-Sweep (CMS)

CMS runs major parts of its collection concurrently with the application threads. That means:

  • It uses more CPU cycles, because GC work competes with the region server threads.
  • Pauses are typically shorter, which is important for request latency and region server heartbeats.
  • On failure or under memory pressure, CMS can fall back to a “stop-the-world” full GC, which will pause the entire JVM.

In HBase, the risk of these longer pauses can be reduced when the heap is sized carefully and memstore allocations avoid excessive old-generation fragmentation. This is one of the reasons why MSLAB (MemStore-Local Allocation Buffers) became important.

ParallelGC

ParallelGC focuses on throughput: it runs stop-the-world collections with multiple threads:

  • Better raw throughput than CMS in many cases.
  • All collections are stop-the-world; the JVM is paused during each collection cycle.
  • Pause times typically scale at roughly ~1s per GB of heap for full collections, which can be unacceptable under high load.

For HBase, that meant ParallelGC could easily create multi-second pauses on heavily loaded clusters, causing timeouts, region reassignment or client errors. That’s why many operators preferred CMS despite its complexity and CPU cost.

MSLAB (MemStore-Local Allocation Buffers)

Many of the worst GC pauses in HBase were caused by fragmentation in the old generation. CMS cannot compact the heap without a full stop-the-world pause, so a highly fragmented old gen leads to long “Juliet” pauses when the JVM finally has to compact.

MSLAB (MemStore-Local Allocation Buffers) improves this situation by allocating memstore data in fixed-size chunks that are placed into the old generation in a more controlled way. This reduces fragmentation and makes CMS behaviour more predictable.

Starting with HBase 0.92, MSLAB is enabled by default. Typical configuration looked like this:

hbase.hregion.memstore.mslab.enabled=true
hbase.hregion.memstore.mslab.chunksize=2MB       # 2MB by default
hbase.hregion.memstore.mslab.max.allocation=256KB # 256KB by default

The idea is:

  • Memstore allocations go into controlled chunks rather than scattered small objects.
  • These chunks live in the old generation, but fragment it much less.
  • CMS can run shorter and more predictable collections, reducing long GC pauses that used to bring region servers down.

For more background, see classic presentations on HBase GC and MSLAB (for example Todd Lipcon’s early talks), which walk through how heap layout and memstore behaviour interact with the JVM collectors.

When this tuning still makes sense

You might still care about this pattern if:

  • You maintain a legacy HBase cluster on Java 7 or 8 where CMS and ParallelGC are still supported.
  • You are debugging long GC pauses and want to understand why MSLAB became the default.
  • You are planning a migration from an old CDH/HBase environment and need to stabilise it first.

For modern deployments, you will usually:

  • Run on newer Java versions where CMS is no longer available and G1GC (or other collectors) are preferred.
  • Follow up-to-date HBase tuning guides for heap sizing, off-heap usage and GC selection.
  • Focus on schema design, compaction strategy and data model changes rather than relying only on GC flags.

In other words: this configuration is part of the historical toolbox that kept early HBase clusters alive. It is still useful to know how and why it worked, but you should not blindly copy these flags into a modern JVM without checking current HBase and Java recommendations.

If you need help with distributed systems, backend engineering, or data platforms, check my Services.

Most read articles

Why Is Customer Obsession Disappearing?

Many companies trade real customer-obsession for automated, low-empathy support. Through examples from Coinbase, PayPal, GO Telecommunications and AT&T, this article shows how reliance on AI chatbots, outsourced call centers, and KPI-driven workflows erodes trust, NPS and customer retention. It argues that human-centric support—treating support as strategic investment instead of cost—is still a core growth engine in competitive markets. It's wild that even with all the cool tech we've got these days, like AI solving complex equations and doing business across time zones in a flash, so many companies are still struggling with the basics: taking care of their customers. The drama around Coinbase's customer support is a prime example of even tech giants messing up. And it's not just Coinbase — it's a big-picture issue for the whole industry. At some point, the idea of "customer obsession" got replaced with "customer automation," and no...

How to scale MySQL perfectly

When MySQL reaches its limits, scaling cannot rely on hardware alone. This article explains how strategic techniques such as caching, sharding and operational optimisation can drastically reduce load and improve application responsiveness. It outlines how in-memory systems like Redis or Memcached offload repeated reads, how horizontal sharding mechanisms distribute data for massive scale, and how tools such as Vitess, ProxySQL and HAProxy support routing, failover and cluster management. The summary also highlights essential practices including query tuning, indexing, replication and connection management. Together these approaches form a modern DevOps strategy that transforms MySQL from a single bottleneck into a resilient, scalable data layer able to grow with your application. When your MySQL database reaches its performance limits, vertical scaling through hardware upgrades provides a temporary solution. Long-term growth, though, requires a more comprehensive approach. This invo...

What the Heck is Superposition and Entanglement?

This post is about superposition and interference in simple, intuitive terms. It describes how quantum states combine, how probability amplitudes add, and why interference patterns appear in systems such as electrons, photons and waves. The goal is to give a clear, non mathematical understanding of how quantum behavior emerges from the rules of wave functions and measurement. If you’ve ever heard the words superposition or entanglement thrown around in conversations about quantum physics, you may have nodded politely while your brain quietly filed them away in the "too confusing to deal with" folder.  These aren't just theoretical quirks; they're the foundation of mind-bending tech like Google's latest quantum chip, the Willow with its 105 qubits. Superposition challenges our understanding of reality, suggesting that particles don't have definite states until observed. This principle is crucial in quantum technologies, enabling phenomena like quantum comp...