# twitter-archive/snowflake

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/twitter-archive-snowflake).**

7,775 stars · 1,117 forks · Scala · archived

## Links

- GitHub: https://github.com/twitter-archive/snowflake
- Homepage: http://twitter.com/
- awesome-repositories: https://awesome-repositories.com/repository/twitter-archive-snowflake.md

## Description

Snowflake is a distributed unique ID generation service designed to produce non-colliding, time-ordered identification numbers at high scale. It functions as a scalable ID issuer that creates distinct entity identifiers across multiple server nodes to avoid coordination bottlenecks.

The system utilizes stateless identifier coordination, calculating unique IDs through a deterministic mathematical formula rather than relying on a central database to track the last issued number. This approach allows it to generate identifiers for distributed database primary keys and high-scale transaction tracking without a central bottleneck.

The service ensures uniqueness and chronological ordering by combining millisecond timestamps, unique worker identifiers, and sequence counters into a single bit-packed integer.

## Tags

### Networking & Communication

- [Snowflake ID Generators](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-computing/distributed-id-generators/snowflake-id-generators.md) — Implements the Snowflake algorithm to produce time-ordered unique IDs from timestamps, worker IDs, and sequences.
- [Deterministic ID Generation](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-computing/deterministic-id-generation.md) — Generates unique identifiers using a deterministic mathematical formula, eliminating the need for a central state database.
- [Snowflake ID Compositions](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-computing/deterministic-id-generation/snowflake-id-pagination/snowflake-id-compositions.md) — Calculates unique IDs by composing an epoch timestamp, worker ID, and sequence counter.
- [Distributed ID Generators](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-computing/distributed-id-generators.md) — Provides a service for creating globally unique identification numbers across multiple servers to avoid collisions.
- [High-Throughput ID Generators](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-computing/distributed-id-generators/high-throughput-id-generators.md) — Delivers unique IDs at high throughput across multiple server nodes without central coordination bottlenecks.
- [ZooKeeper Worker Assignments](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-computing/distributed-id-generators/snowflake-id-generators/zookeeper-worker-assignments.md) — Assigns unique worker identifiers to individual nodes to ensure no two machines produce the same ID.
- [Distributed Systems Coordination](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-systems-coordination.md) — Coordinates the assignment of unique identities across a network of services to avoid central bottlenecks.

### Data & Databases

- [Unique Identifier Generators](https://awesome-repositories.com/f/data-databases/data-management/unique-identifier-generators.md) — Creates globally unique identification numbers to distinguish entities across a distributed network of services. ([source](https://cdn.jsdelivr.net/gh/twitter-archive/snowflake@master/README.md))
- [Distributed Identifier Generators](https://awesome-repositories.com/f/data-databases/data-management/unique-identifier-generators/distributed-identifier-generators.md) — Generates unique primary keys across distributed nodes without requiring a central database to track the last issued ID.
- [Distributed Primary Key Generation](https://awesome-repositories.com/f/data-databases/entity-modeling/primary-keys/distributed-primary-key-generation.md) — Generates non-repeating, time-ordered identifiers to serve as primary keys for records in distributed databases.
- [High-Scale Event Identifiers](https://awesome-repositories.com/f/data-databases/high-scale-event-identifiers.md) — Produces a steady stream of unique identifiers to track individual events or transactions across a large application.

### Software Engineering & Architecture

- [Chronological ID Sequencing](https://awesome-repositories.com/f/software-engineering-architecture/causal-ordering-timestamps/chronological-id-sequencing.md) — Arranges identifiers chronologically by placing the timestamp in the most significant bits of the integer.
- [Worker Identity Assignments](https://awesome-repositories.com/f/software-engineering-architecture/distributed-coordination-systems/task-coordinations/master-worker-coordination/worker-identity-assignments.md) — Assigns unique worker identities to nodes at startup to prevent ID collisions across the distributed network.
- [Millisecond Clock Sequences](https://awesome-repositories.com/f/software-engineering-architecture/causal-ordering-timestamps/millisecond-clock-sequences.md) — Implements sequence numbers that reset every millisecond to ensure uniqueness for IDs generated within the same tick.
- [Identifier Bit-Packing](https://awesome-repositories.com/f/software-engineering-architecture/memory-layout-optimizations/bit-packed-storage/identifier-bit-packing.md) — Combines timestamps, worker IDs, and sequences into a single 64-bit integer using bit-packing.

### Development Tools & Productivity

- [Epoch-Based Time Representations](https://awesome-repositories.com/f/development-tools-productivity/date-and-time-utilities/component-based-date-time-specifications/relative-date-time-specifications/epoch-based-time-representations.md) — Uses a custom epoch starting date to maximize the number of available bits for the timestamp component.
