A high-performance distributed ID generation service offering segment and snowflake algorithms, used internally at Meituan-Dianping.
Leaf is a distributed ID generation service that provides unique identifiers for applications in a service-oriented architecture. It solves the problem of generating scalable, high-performance IDs by offering two modes: segment mode for database-backed range allocation and snowflake mode for decentralized, time-ordered IDs. It is designed to meet the demands of large-scale production systems with low latency and high throughput.
Developers and architects building distributed systems, microservices, or high-traffic applications that require reliable, unique ID generation without single points of failure.
Developers choose Leaf for its proven performance in production at Meituan-Dianping, its flexibility in supporting multiple ID generation strategies, and its ability to handle high QPS with minimal latency, making it a robust alternative to ad-hoc ID solutions.
Distributed ID Generate Service
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Achieves nearly 50,000 QPS with TP999 latency of 1ms in Meituan-Dianping's production environments, as stated in the README, making it reliable for high-traffic systems.
Supports both segment mode for database-backed ID ranges and snowflake mode for decentralized, time-ordered IDs, allowing flexibility based on application needs, as highlighted in the configuration options.
Designed for service-oriented SOA architectures, it can be integrated via HTTP or RPC to serve as a centralized ID provider, enabling high throughput and low latency in microservices.
Provides a web-based cache monitoring page for segment mode, allowing real-time tracking of ID allocation status, which aids in operational visibility and debugging.
Segment mode requires MySQL setup with a specific table schema, and snowflake mode needs ZooKeeper, adding deployment, maintenance, and potential single points of failure.
In snowflake mode, Leaf uses the first network card IP directly, which can cause workId waste in environments with dynamic IP changes, as admitted in the README's attention note.
Initial deployment involves multiple steps like database configuration, properties file tuning, and service registration, which can be cumbersome for rapid prototyping or teams without DevOps expertise.