[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Optimisations: A couple of low hanging fruits going for

jmesnil do-not-reply at jboss.com
Thu May 15 04:44:43 EDT 2008


"timfox" wrote : "jmesnil" wrote : 
  |   | It seems the bottleneck is the generation of the UUID.
  |   | 
  |   | When using UUID.randomUUID(), the implementation uses a SecureRandom.
  |   | If I use Random instead and creates the UUID with new UUID(rand.nextLong(), nextLong(), the perf increases significantely.
  |   | 
  | 
  | I don't think we should be using random UUIDs at all, since they're... well random (so can clash).
  | 
  | Instead I think we should use a variant 2 UUID.

After thinking a little about it, I think we do not uniquely identify the right object.
We do not need to generate a UUID for every message. We should instead generate a UUID for our MessageProducer and append a sequence number for each message sent by this producer.
This means we only need to generate a single UUID per producer. This so significantely reduces the number of generated ID that I think we can consider using a Random UUID with a unsignificant risk of clash.

If we do that our message ID will have the format: "ID:<producer uuid>:<sequence number>"

wdyt?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150963#4150963

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150963



More information about the jboss-dev-forums mailing list