Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machine ID for Distributed Contexts #1

Closed
CMCDragonkai opened this issue Sep 28, 2021 · 6 comments
Closed

Machine ID for Distributed Contexts #1

CMCDragonkai opened this issue Sep 28, 2021 · 6 comments

Comments

@CMCDragonkai
Copy link

I'm not sure if the spec mentions this, but I thought given that one of the inspirations was the usage of snowflake, I thought at the very least there's a way to provide the machine/node-id.

Unless the expectation is for the user to concatenate the uuid with the machine id, but in that case I might as well use the old uuids versions, I could already do this.

@kripod
Copy link
Owner

kripod commented Sep 28, 2021

Great idea, thank you for sharing it!

As the spec draft mentions it:

implementations MAY dedicate a portion of the node's most significant random bits to a pseudo-random machineID which helps identify UUIDs created by a given node. This works to add an extra layer of collision avoidance.

The machineID MUST NOT be an IEEE 802 MAC address. The creation and negotiation of the machineID among distributed nodes is out of scope for this specification.

How should we document the generation of machine IDs and how long may they be out of the 62 random bits? (The spec doesn’t seem to mention anything about maximum length.)

@CMCDragonkai
Copy link
Author

CMCDragonkai commented Sep 29, 2021 via email

@kripod
Copy link
Owner

kripod commented Sep 29, 2021

The machine ID has to be way less than 62 bits, otherwise there would be no space left for random bits. The most significant random bits are the first bits inside the last 62 bits of a v7 UUID.

There isn’t an implementation yet, but I was curious how we could document this feature clearly.

@CMCDragonkai
Copy link
Author

I did some calculations on collision probabilities and found that it's easier if I just concatenate my machine ids at the end instead of trying to fit it into the UUIDs.

@hiimmrdave
Copy link

Just browsing issues since I'm interested in using the package. It's probably best to close this as out-of-scope based on the latest UUIDv7 draft.

The text cited above does not exist in the draft-04 text. The relevant issue is handled here: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#section-6.3

  With this method, a pseudo-random Node ID value is placed within
  the UUID layout.  This identifier helps ensure the bit-space for a
  given node is unique, resulting in UUIDs that do not conflict with
  any other UUID created by another node with a different node id.
  Implementations that choose to leverage an embedded node id SHOULD
  utilize UUIDv8....

UUIDv8 gives application authors the option of including node ids, different precision of timestamp, or any other data that leaves room for sufficient randomness within 122 bits. For my use, v7 makes UUID quick enough that the generating node can be shoved into metadata if it's needed at all.

@kripod
Copy link
Owner

kripod commented Nov 23, 2022

@hiimmrdave good point, I’m closing this as suggested. Thanks for your response.

@kripod kripod closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants