Time-Sorted Unique Identifiers (TSIDs) are 64-bit identifiers that are both globally unique and naturally sortable by generation time. The Hypersistence TSID library provides a Java implementation where each ID encodes a 42-bit millisecond timestamp, a configurable node ID (up to 20 bits), and a counter. This structure allows distributed systems to generate unique IDs across nodes without coordination by assigning each node a distinct node ID. The library supports generating TSIDs via a thread-safe factory, serializing them as long integers or Base-32 encoded 13-character strings, deserializing them back, and extracting the embedded timestamp. Factory configuration supports custom clocks, custom epochs, and node settings via builder methods, system properties, or environment variables.

7m read timeFrom feeds.feedblitz.com
Post cover image
Table of contents
1. Introduction2. What are TSIDs3. Dependencies4. Generating TSIDs5. Serializing TSIDs6. Summary
872 Impressions