<!-- MHonArc v2.4.4 --> <!--X-Subject: Re: Unique id's --> <!--X-From-R13: pbqreNvoz.arg --> <!--X-Date: from tacitus.globecomm.net [207.51.48.7] by mx3.ibm.net id 860828145.98328-1 Sat Apr 12 06:55:45 1997 --> <!--X-Message-Id: 199704120700.HAA575052#out2,ibm.net --> <!--X-Content-Type: text/plain --> <!--X-Reference: 199704120458.EAA318871#out1,ibm.net --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, Re: Unique id's</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:coder#ibm,net"> </head> <body background="/backgrounds/paperback.gif" bgcolor="#ffffff" text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000"> <font size="+4" color="#804040"> <strong><em>MUD-Dev<br>mailing list archive</em></strong> </font> <br> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00102.html">Previous</a> | <a href="msg00104.html">Next</a> ] Thread: [ <a href="msg00101.html">Previous</a> | <a href="msg00106.html">Next</a> ] Index: [ <A HREF="author.html#00103">Author</A> | <A HREF="#00103">Date</A> | <A HREF="thread.html#00103">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>Re: Unique id's</H1> <HR> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: <<A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A>></LI> <LI><em>Subject</em>: Re: Unique id's</LI> <LI><em>From</em>: <A HREF="mailto:coder#ibm,net">coder#ibm,net</A></LI> <LI><em>Date</em>: Fri, 11 Apr 97 23:33:04 -0700</LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Body-of-Message--> <PRE> On 12/04/97 at 12:51 AM, "Jon A. Lambert" <jlsysinc#ix,netcom.com> said: >> From: clawrenc#cup,hp.com >> Yeah, but I figure that the date check for the ObjectID (time_T value >> comparison of requested vs received objects) should pretty well trap >> most of them. >> >Isn't it possible, especially in a multi-threaded system, to generate >identical IDs if you depend on date/time stamps? While possible in those loose terms, if your ObjectID allocation code is thread-safe its not a problem. Its just a question of making sure that you don't have a race conditions in your container updates/checks to get the records# half of the ObjectID (which can be a problem depending on your approaches). I brute forced the issue as I recall my putting a mutex on the ObjectID allocation calls so while multiple ID's can be requested simultaneously, the actual provision of ID's is serialised. After that it was just a question of making sure that the period that the mutex is locked for a call is kept to an absolute minimum. Note: This gets messy if you go for a distributed database. There's no problem if two ObjectID's contain the same timestamp. It doesn't matter at all. What has to be unique is the combination of record# and timestamp -- and that combo must be unique for the entire life of the database. Happily this is not a problem until April 2038, longer if you chose a different timestamp format. >I'm currently >generating IDs just like Cold, except I'm using a big int and never fill >in the holes. I used to use ColdX's format (stolen whole cloth from MOO): a 32bit integer record# for the ObjectID which was a direct index into the DB for the object. In running a couple early spoof/watcher/spawning mobile tests I found I could easily wrap 2^32 created and destroyed objects in a week or so. That wasn't good enough, and thus was born my current concept of recycling and a 64bit time_t/Record# ObjectID. This leaves me with a maximum of 2^32 (unsigned) simultaneous objects in the DB, which should be enough. I'm rather pleased actually -- the last time I had the server in a shape it would actually run, I had it creating and destroying about 100,000 objects per hour while mobiles wandered about the game going in and out of spoof/watcher areas, and breeding like crazy. It ran for a good 5 or 6 days before syslodg crashed when it ran out of disk space for its logs... The DB grew by about 5% almost immediately to handle the "float" for the extra Object ID's, and after that just stayed constant. Figure, that's what, about 40+ million objects being created and destroyed... Certainly not enough to cause a 32bit wrap, but a good enough test to demonstrate that the idea works. -- J C Lawrence Internet: claw#null,net ----------(*) Internet: coder#ibm,net ...Honourary Member of Clan McFud -- Teamer's Avenging Monolith... </PRE> <!--X-Body-of-Message-End--> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00102.html">Re: Of disk swapping, database structure & project management..</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00104.html">Re: Yet Another Introduction</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg00101.html">Re: Unique id's</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00106.html">Re: Unique id's</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00103"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00103"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> <ul><li>Thread context: <BLOCKQUOTE><UL> <LI><strong><A NAME="00066" HREF="msg00066.html">Dupes are my fault (again)</A></strong>, coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Thu 10 Apr 1997, 12:08 GMT <LI><strong><A NAME="00061" HREF="msg00061.html">Unique id's</A></strong>, Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 09 Apr 1997, 21:46 GMT <UL> <li><Possible follow-up(s)><br> <LI><strong><A NAME="00094" HREF="msg00094.html">Re: Unique id's</A></strong>, clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Sat 12 Apr 1997, 06:03 GMT </LI> <LI><strong><A NAME="00101" HREF="msg00101.html">Re: Unique id's</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sat 12 Apr 1997, 11:49 GMT </LI> <LI><strong><A NAME="00103" HREF="msg00103.html">Re: Unique id's</A></strong>, coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Sat 12 Apr 1997, 13:55 GMT </LI> <LI><strong><A NAME="00106" HREF="msg00106.html">Re: Unique id's</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sat 12 Apr 1997, 23:53 GMT </LI> <LI><strong><A NAME="00119" HREF="msg00119.html">Re: Unique id's</A></strong>, coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Mon 14 Apr 1997, 00:01 GMT </LI> <LI><strong><A NAME="00122" HREF="msg00122.html">Re: Unique id's</A></strong>, Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Mon 14 Apr 1997, 02:40 GMT </LI> <LI><strong><A NAME="00123" HREF="msg00123.html">Re: Unique id's</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 14 Apr 1997, 04:31 GMT </LI> </UL> </LI> </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>