Getting Started
TimeSeed Overview
TimeSeed is a high-performance, chronologically ordered unique ID generator designed for distributed systems. Unlike fixed-format ID generators (like Snowflake), TimeSeed provides configurable bit allocation, allowing you to tailor timestamp precision, machine identification, datacenter identification, and sequence capacity to fit your specific scale and performance needs.
TimeSeed is a high-performance, chronologically ordered unique ID generator designed for distributed systems. Unlike fixed-format ID generators (like Snowflake), TimeSeed provides configurable bit allocation, allowing you to tailor timestamp precision, machine identification, datacenter identification, and sequence capacity to fit your specific scale and performance needs.
Key Features
- Strict Ordering: Guarantees perfect chronological ordering down to the millisecond.
- Configurable Bit Space: Easily balance timestamps, datacenter IDs, machine IDs, and sequence slots.
- Multiple Representation Formats: Natively convert IDs between 128-bit integers, hex strings, Crockford base32, URL-safe base62, and binary format.
- Zero Dependencies: Pure Python library with zero external runtime requirements.
- Thread-safe: Minimal locking and highly optimized bitwise operations for multi-threaded and high-throughput environments.
Default Bit Allocation (Total: 128 bits)
- 48 bits: Timestamp (~8920 years capacity)
- 16 bits: Machine ID (65,536 machines maximum)
- 16 bits: Datacenter ID (65,536 datacenters maximum)
- 42 bits: Sequence (up to 4.4 trillion IDs per millisecond per node)
- 6 bits: Reserved for future utilization
+--------------------+------------------+------------------+-----------------------+-----------+
| Timestamp (48 bits)| Machine (16 bits)| Datacenter (16b) | Sequence (42 bits) | Res. (6b) |
+--------------------+------------------+------------------+-----------------------+-----------+