Snowflake ID Generator Snowflake ID 生成器


          

What is Snowflake ID?

Snowflake is a distributed unique ID generation algorithm originally developed by Twitter. It produces 64-bit integers that are roughly time-ordered, sortable, and can be generated without coordination across multiple machines. The structure is:

1 bit (sign) + 41 bits (timestamp) + 10 bits (machine ID) + 12 bits (sequence)

This allows up to 1024 machines and 4096 IDs per millisecond per machine. This tool uses a custom epoch of 2022-01-01 00:00:00 UTC.

When to Use Snowflake

Ideal for database primary keys in distributed systems, microservices, and high-throughput applications where you need roughly sequential, unique, and sortable IDs without a central ID service.

什么是 Snowflake ID?

Snowflake 是 Twitter 开发的分布式唯一 ID 生成算法。它生成 64 位整数,大致按时间有序、可排序,且无需多机协调。结构如下:

1 位(符号位) + 41 位(时间戳) + 10 位(机器 ID) + 12 位(序列号)

最多支持 1024 台机器,每台机器每毫秒可生成 4096 个 ID。本工具使用自定义纪元时间:2022-01-01 00:00:00 UTC。

适用场景

非常适合分布式系统、微服务、高并发应用中的数据库主键,需要大致有序、唯一且可排序的 ID,又无需中心化 ID 服务时使用。