in reply to Re^2: How do I get a unique Perl Interpreter ID?
in thread How do I get a unique Perl Interpreter ID?

I'd prefer to not have the IDs longer than they need to be. Something that'd be unique across a single server farm over some fixed interval of time like 100 days is good enough for my purposes.

When I need unique IDs, I usually have a RDBMS running somewhere that has solved all of the nasty race and locking problems. What if you would simply (ab)use a RBDMS, create a sequence there, and get the sequence's nextval whenever you need an ID?

Or, if you work across several RDBMS, you could concat a server ID (IP address or hostname, if you have no better idea) and a sequence number into a locally unique ID.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^3: How do I get a unique Perl Interpreter ID?

Replies are listed 'Best First'.
Re^4: How do I get a unique Perl Interpreter ID?
by wrog (Friar) on Dec 02, 2011 at 17:21 UTC
    What if you would simply (ab)use a RBDMS, create a sequence there, and get the sequence's nextval whenever you need an ID?
    because a call out across the network to a bottlenecked server is exactly the sort of thing I'm trying to avoid (compare with interpreter ID being right there in thread-specific storage).