Closed xingwen1987 closed 6 years ago
See #8 for those confused by this "issue".
only to explain Twitter's Snowflake algorithm will create a lots of same Id
No, the algorithm doesn't. Your implementation of it does (apparently).
From the README:
The generator-id-part of the Id is the part that you 'configure'; it could correspond to a host, thread, datacenter or continent: it's up to you. However, the generator-id should be unique in the system: if you have several hosts or threads generating Id's, each host or thread should have it's own generator-id.
If you're using multiple generators (across machines or in separate threads or...) you'll want to make sure each generator is assigned it's own unique Id.
https://www.cnblogs.com/yushuo/p/9406906.html This blog information, only to explain Twitter's Snowflake algorithm will create a lots of same Id under the pressure test using Jmeter when test thread number >= 1000,
select DataId from IdTest GROUP BY DataId HAVING COUNT(DataId)>1
this SQL means how many data are duplicated.so I hope that our IdGen can do a good stress test, and give us test result, to ensure that the generated Id is always unique.
Thanks!