-
Notifications
You must be signed in to change notification settings - Fork 5
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
SecureRandom.nextLong as node identifier #4
Comments
Hi, I am not an expert in this field so I can't give you a definite answer. I would probably be a bit cautious about random numbers as node identifiers unless it can be guaranteed that there won't be any duplicates. If your processes are independent, I assume they run on different JVMs as well. Consider, for example, what happens if two JVMs happen to start at the same time and It all comes down to how much you trust your node identifier generation process to produce unique identifiers. If the chances of a collision are miniscule, I don't see a problem with the approach you are suggesting. BTW, this library is not actively maintained and I am not aware of anyone using it in production. Caveat emptor! |
Appreciate your answer. We have pretty much the same thoughts. We are actually enhancing the code a little bit to use atomics locks, quite similar to the Elasticsearch implementation to the same standard. We'll be happy to open a PR once we're done in case you're interested. Thank you! |
Sounds good! 👍🏽 |
Hello.
This is more like a question than an issue: Consider multiple independent services generating IDs on the same host/Mac address, how safe/unsafe is it to generate the node identifier for each service once at bootstrap with something like SecureRandom.nextLong?
Thanks a lot
The text was updated successfully, but these errors were encountered: