Databases 5 min read

Understanding Global Sequence Generation in DBLE: Snowflake and Offset‑Step Mechanisms

This article introduces DBLE's advanced global sequence features, explaining the Snowflake algorithm with its timestamp‑based ID generation and the offset‑step token allocator, detailing their designs, capacities, cluster considerations, and practical trade‑offs for distributed database systems.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Understanding Global Sequence Generation in DBLE: Snowflake and Offset‑Step Mechanisms

In the previous session we gave a brief introduction to the hint feature; now we move on to more advanced capabilities.

DBLE provides four kinds of global sequences, which are essentially two underlying mechanisms presented in four different forms.

The first method is the Snowflake algorithm, originally proposed by Twitter. It uses a 41‑bit timestamp combined with a 12‑bit sequence number per millisecond, allowing up to 2^12 = 4096 IDs each millisecond, roughly four million IDs per second—more than enough for most applications.

For clustered deployments, a machine‑ID is added to the timestamp to guarantee uniqueness across nodes. If the per‑millisecond limit is exceeded, the generator simply waits for the next millisecond, introducing a slight delay but preserving uniqueness.

The second method, called offset‑step, employs a token generator that allocates a block of IDs (e.g., a step of 1000) to a DBLE instance. Each instance receives a distinct range, preventing overlap even across multiple tables, and the allocated range can be reused, unlike the time‑based Snowflake IDs. This approach requires a carrier such as MySQL or ZooKeeper to store and manage the token state.

These two mechanisms each have clear advantages and drawbacks, and DBLE allows you to choose the one that best fits your workload and architectural needs.

For further learning, refer to the DBLE code repositories and the accompanying course materials.

distributed systemsDatabasesnowflakeDBLEglobal sequenceoffset-step
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.