Randomizing Strings In A Microservices World
On Tue, 10 Dec 2019 at 12:12, Tim Daneliuk <info at tundraware.com> wrote:
> - Each of these services needs to produce a string of ten digits
> guaranteed to be unique
> on a per service instance basis AND to not collide for - oh, let's say -
> forever :)s
> Can anyone suggest a randomization method that might achieve this
> My first thought was to something like nanonseconds since the epoch plus
> unique about the service instance - like it's IP? (This is in a K8s
> cluster) - to
> see the randomization and essentially eliminate the string being repeated.
10 digits is only 999999999. That's not a very big number. Forget
nanoseconds since the epoch, that won't currently give you seconds since
the epoch - let alone combining with any other identifier.
$ date '+%s'