Pre-generating GUIDs for use in python?
Posted
by rjuiaa1
on Stack Overflow
See other posts from Stack Overflow
or by rjuiaa1
Published on 2010-04-08T22:43:49Z
Indexed on
2010/04/08
22:53 UTC
Read the original article
Hit count: 388
I have a python program that needs to generate several guids and hand them back with some other data to a client over the network. It may be hit with a lot of requests in a short time period and I would like the latency to be as low as reasonably possible.
Ideally, rather than generating new guids on the fly as the client waits for a response, I would rather be bulk-generating a list of guids in the background that is continually replenished so that I always have pre-generated ones ready to hand out.
I am using the uuid module in python on linux. I understand that this is using the uuidd daemon to get uuids. Does uuidd already take care of pre-genreating uuids so that it always has some ready? From the documentation it appears that it does not.
Is there some setting in python or with uuidd to get it to do this automatically? Is there a more elegant approach then manually creating a background thread in my program that maintains a list of uuids?
© Stack Overflow or respective owner