Leaf is a distributed unique ID generation system that provides two distinct modes for producing identifiers across multiple application instances without central coordination. It offers both a database-backed segment mode, which allocates blocks of IDs from a database table and caches them in memory for high throughput, and a Snowflake-style mode that combines timestamps, worker identifiers, and sequence counters to produce time-sortable unique IDs.
The system distinguishes itself by offering dual-mode generation through a single RESTful endpoint, allowing applications to choose between segment-based allocation for maximum throughput or Snowflake-style generation for time-ordered IDs with minimal persistence. Worker identity coordination ensures no duplicate IDs across distributed nodes, while the segment mode's in-memory caching minimizes per-request database calls. A web-based monitoring dashboard provides visibility into the current state of ID segment caches per business tag, helping operators track consumption.
The system supports globally unique identifier management across services and data centers, with both generation modes designed for high-performance, low-latency operation. It provides a stateless HTTP endpoint that any HTTP client can call to obtain unique identifiers for specific business tags, making integration straightforward for microservice architectures.