mirror of
https://github.com/sony/sonyflake.git
synced 2026-11-30 09:26:28 +00:00
Update README.md
This commit is contained in:
1 parent
4ae3f1aeaa
commit
3ffd8c4254
1 file changed
+12
@@ -7,12 +7,24 @@ Sonyflake
|
|||||||
[](https://goreportcard.com/report/github.com/sony/sonyflake)
|
[](https://goreportcard.com/report/github.com/sony/sonyflake)
|
||||||
|
|
||||||
Sonyflake is a distributed unique ID generator inspired by [Twitter's Snowflake](https://blog.twitter.com/2010/announcing-snowflake).
|
Sonyflake is a distributed unique ID generator inspired by [Twitter's Snowflake](https://blog.twitter.com/2010/announcing-snowflake).
|
||||||
|
|
||||||
|
Sonyflake focuses on lifetime and performance on many host/core environment.
|
||||||
|
So it has a different bit assignment from Snowflake.
|
||||||
A Sonyflake ID is composed of
|
A Sonyflake ID is composed of
|
||||||
|
|
||||||
39 bits for time in units of 10 msec
|
39 bits for time in units of 10 msec
|
||||||
8 bits for a sequence number
|
8 bits for a sequence number
|
||||||
16 bits for a machine id
|
16 bits for a machine id
|
||||||
|
|
||||||
|
As a result, Sonyflake has the following advantages and disadvantages:
|
||||||
|
|
||||||
|
- The lifetime (174 years) is longer than that of Snowflake (69 years)
|
||||||
|
- It can work in more distributed machines (2^16) than Snowflake (2^10)
|
||||||
|
- It can generate 2^8 IDs per 10 msec at most in a single machine/thread (slower than Snowflake)
|
||||||
|
|
||||||
|
However, if you want more generation rate in a single host,
|
||||||
|
you can easily run multiple Sonyflake ID generators concurrently using goroutines.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user