← Back to team overview

nova team mailing list archive

Re: Instance IDs and models in the ORM world


On 05-10-2010 20:39, Michael Gundlach wrote:
>> I agree with Jay's comments elsewhere in this thread -- it seems a 
>> better idea to use a UUID for your internal_id, rather than a long 
>> int.  That way, the ID is an extra 64 bits longer, so you can 
>> generate them randomly on independent nodes without worrying about 
>> collisions.
> I think we discussed this in IRC -- 128 bits turns into a 26 byte
> EC2 ID vs 14 for a 64 bit int, and someone (Soren?) had a strong
> negative preference.

If I did, I think I'm over it now :)

> Actually, I just checked in code only using a 32 bit integer, and
> I'd like some convincing that this isn't sufficient for the
> foreseeable future.

I can provide that. :)

> We want to support 1 million instances, right?  Which is 1/4000 the 
> keyspace, so we have something like a 1 in 4000 chance of a
> collision once we hit a million instances.

Mm... Not exactly. 1/4000 is the chance of collision for the last one,
assuming an even distribution.

You reach a 1/4000 chance of having had *a* collision before you
even start 150 instances. After a million instances, that figure grows
to 99.99999999999999999999999999999999999999999999999999% or
thereabouts. We're in 99% territory after a measly 200,000 instances.

Soren Hansen
Ubuntu Developer    http://www.ubuntu.com/
OpenStack Developer http://www.openstack.org/

Attachment: signature.asc
Description: OpenPGP digital signature

Follow ups