Documentation ¶
Overview ¶
Package main seeks to determine if the approach used delivers sufficiently unique IDs in go applications potentially running multiple goroutines.
Considerations:
- objective: keep IDs and their encoded representation short - you can generate a lot of random numbers in 1 second - is 48 bits of randomness per second enough - using a faster, scalable, random generator raises the bar
In addition to this test, a single-threaded test using stdout / sort / uniq, a run of 10 million or more results in no duplicates on various test machines:
rid -c 10000000 | sort | uniq -d (no output, meaning no duplicates)
Running this test results in output like: Total keys: 40,000,000. Keys in last time tick: 1,825,240. Number of dupes: 0
Click to show internal directories.
Click to hide internal directories.