Randomizing Strings In A Microservices World
Tim Daneliuk
info at tundraware.com
Mon Dec 9 19:52:11 EST 2019
I ran across a kind of fun problem today that I wanted to run past you Gentle Geniuses (tm):
- Imagine an environment in which there may be multiple instances of a given
microservice written in Python.
- 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 efficiently?
My first thought was to something like nanonseconds since the epoch plus something
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.
Ideas welcome ..
P.S. I do not want to resort to a number generation service that each instance asks
for a new number. The network and service call overhead militates against this
in my application.
More information about the Python-list
mailing list