A few apps I've worked on have needed to ID entities by UUID for a variety of reasons. One in particular creates large numbers of entities.
This can be a bit problematic under load - the UUID algorithm built into ColdFusion MX (through version 7, at least) is notoriously slow. Hopefully, Scorpio will speed it up - I believe java.util.UUID is part of Java 5.
Until then, I've found that an external UUID generator called JUG (Java UUID Generator) works great.
A sample test of 1000 UUID creations (run wonderfully unscientifically) results in the following:
JUG: 9ms
CreateUUID(): 1235ms
Bit of a speedup.
JUG also gives the option of using different twists on the UUID algorithm, as well as alternate randum number generators.
Here's an example use:
<cfset uuidGen = createObject("java", "org.safehaus.uuid.UUIDGenerator").getInstance() />
<cfset uuidGen.generateTimeBasedUUID() />
Not too bad, eh?
Happy faster UUIDing!
13 comments - Posted by Joe Rinehart at 7:28 AM - Categories: ColdFusion MX