I ported sonyflake to Java and it worked fine. However, instead of generating 8 digit numbers, I am looking to generate 12 digit unique numbers. The original port uses 16-bit machineId. Because we have at least 2 data centers, but not limited to, I added 8-bits for the data center - using the second octet of the IP address. I tweaked all the settings for the bit lengths, couldn't manage to generate 12-digits numbers. Is there an algorithm inspired by sonyflake or Twitters Snowflake to generate unique 12-digit numbers which uses 16-bit machineId and 8-bit dataCenterId?
Note: Due to company policy, I cannot post my Java port here.
Aucun commentaire:
Enregistrer un commentaire