<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
We neither hate nor love UUIDs, but we like them when they provide
value and we also accept alternatives. What we do hate is ambiguity
and in certain cases UUIDs help.<br>
<br>
Look at the hrefs returned in this sample resource and picture what
you'd store in your database as unique identifier to refer to each
one:<br>
<div>
<div>{"server"=></div>
<div> {"name"=>"kd_test_3",</div>
<div> "flavorRef"=>"<a
href="http://50.56.22.22:8774/v1.1/flavors/3">http://5.5.2.2:8774/v1.1/flavors/3</a>",</div>
<div> "addresses"=></div>
<div> {"public"=>[], "private"=>[{"version"=>4,
"addr"=>"5.5.2.5"}]},</div>
<div> "metadata"=>{"v2"=>"d2", "4"=>"14",
"5"=>"17"},</div>
<div> "imageRef"=>"<a
href="http://50.56.22.22:8774/v1.1/images/1">http://</a><a
href="http://50.56.22.22:8774/v1.1/flavors/3">5.5.2.2</a><a
href="http://50.56.22.22:8774/v1.1/images/1">:8774/v1.1/images/1</a>",</div>
<div> "id"=>26,</div>
<div> "hostId"=>"4e6200284bc7bd28e49016aa047fbdc6a3f5",</div>
<div> "links"=></div>
<div> [{"href"=>"<a
href="http://50.56.22.22:8774/v1.1/servers/26">http://</a><a
href="http://50.56.22.22:8774/v1.1/flavors/3">5.5.2.2</a><a
href="http://50.56.22.22:8774/v1.1/servers/26">:8774/v1.1/servers/26</a>",
"rel"=>"self"},</div>
<div> {"href"=>"<a
href="http://50.56.22.22:8774/v1.1/servers/26">http://</a><a
href="http://50.56.22.22:8774/v1.1/flavors/3">5.5.2.2</a><a
href="http://50.56.22.22:8774/v1.1/servers/26">:8774/v1.1/servers/26</a>",</div>
<div> "rel"=>"bookmark",</div>
<div> "type"=>"application/json"</div>
<div> },</div>
<div> {"href"=>"<a
href="http://50.56.22.22:8774/v1.1/servers/26">http://</a><a
href="http://50.56.22.22:8774/v1.1/flavors/3">5.5.2.2</a><a
href="http://50.56.22.22:8774/v1.1/servers/26">:8774/v1.1/servers/26</a>",</div>
<div> "rel"=>"bookmark",</div>
<div>
"type"=>"application/xml"</div>
<div> }</div>
<div> ],</div>
<div> "status"=>"ACTIVE"</div>
<div> }</div>
<div>}</div>
</div>
<br>
Are the hostnames significant? Are the port numbers significant? Are
the version IDs significant? Is the next URI component significant?
Is the integer ID significant? Mhhh, maybe it's obvious to the
OpenStack implementers, but it leaves quite some room for error for
all the users out there. We end up having to write a little
algorithm that throws away the hostname and port, then throws away
the version number if there is one -- it really should NOT be part
of the URL! -- then looks at the next path component to decide
whether its the resource type and whether the path component after
that is the resource id, or whether there is further nesting of path
components. Then we can assemble a unique ID and see whether we know
about that resource or need to fetch it. It would be really nice to
have a UUID attribute that eliminates this guesswork and we like
UUIDs that start with a type-specific prefix, such as inst-12345 or
img-12345.<br>
<br>
Our recommendation:<br>
- option 1: use canonical hrefs that can be used as unique IDs,
which means without host/port and without version number<br>
- option 2: use a unique ID with a type prefix and include that as
attribute in hrefs, we like small IDs, but we don't care that much<br>
<br>
WRT UUIDs, we try to use integer IDs when we can easily generate
them centrally, but switch to UUIDs when we need to distribute the
ID generation and we keep them as short as practical.<br>
<br>
Thanks much!<br>
Thorsten - CTO RightScale<br>
<br>
<br>
On 6/2/2011 12:40 PM, Jay Pipes wrote:
<blockquote
cite="mid:BANLkTikb_yU_O-9f4MN6x4pEiATys4J3sw@mail.gmail.com"
type="cite">
<pre wrap="">On Thu, Jun 2, 2011 at 1:18 PM, George Reese <a class="moz-txt-link-rfc2396E" href="mailto:george.reese@enstratus.com"><george.reese@enstratus.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I hate UUIDs with a passion.
* They are text fields, which means slower database indexes
</pre>
</blockquote>
<pre wrap="">
Text fields are stored on disk/in memory as bytes the same as any
integer. It's that the number of bytes needed to store it is greater,
resulting in larger indexes and more bytes to store the keys. But, as
Jorge mentioned, some databases have native support for large-integer
types like UUIDs.
</pre>
<blockquote type="cite">
<pre wrap="">* They are completely user-unfriendly. The whole "copy and paste" argument borders on silliness
</pre>
</blockquote>
<pre wrap="">
Yes, it's not easy to remember UUIDs. That's why virtually every
resource has some other way of identifying themselves. Typically, this
is a name attribute, though not all resources enforce uniqueness on
the name attribute, thus the need for a unique identifier.
I don't see people manually looking up resources based on UUIDs. I see
*machines* manually looking up resources based on UUIDs, and humans
looking up resources by, say, name, or (name, tenant_id) or (name,
user_id), etc.
</pre>
<blockquote type="cite">
<pre wrap="">* And uniqueness across regions for "share nothing" can be managed with a variety of alternative options without resorting to the ugliness that is UUIDs
</pre>
</blockquote>
<pre wrap="">
Like URIs? I don't know of any other options that would work. Please
let us know what you think about in this respect.
-jay
_______________________________________________
Mailing list: <a class="moz-txt-link-freetext" href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a>
Post to : <a class="moz-txt-link-abbreviated" href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a>
Unsubscribe : <a class="moz-txt-link-freetext" href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a>
More help : <a class="moz-txt-link-freetext" href="https://help.launchpad.net/ListHelp">https://help.launchpad.net/ListHelp</a>
</pre>
</blockquote>
</body>
</html>