At the moment, I'm playing around with CFTHREAD to launch events in our
framework to increase speed etc as opposed to running on CF6 and 7. The
performance benefits are great when the event code takes a long time to run,
but when the event code is relatively small, I'm seeing a bottleneck in
actually calling CFTHREAD.

Because I don't care about these threads returning a value, I really have no
need to name the threads with anything meaningful and, because I have no
idea if multiple events of the same type are being fired in the same page
request (quite possible), I have to avoid CFTHREAD naming clashes.

To that end, I'm using CreateUUID() to name the threads like so as it
guarantees uniqueness:

<cfthread name="#CreateUUID()#" action="run" eventArgs="#arguments#">
        <!--- event invocation code here... ---> </cfthread>

The problem I'm seeing is that when lots of small events are firing, using
cfthread is actually slower than not threading the code because along with
the cfthread instantiation which is deep copying my arguments, CreateUUID()
is *slow* and introduces even more lag into the request.

During tests, if I introduce an artificial pause into the system to
accentuate the length of any given running event then obviously the speed of
CreateUUID() becomes a non issue compared to the length of time the thread
is actually running. 

In practice however, I have a good mix of long running and short running
events and I can see that the CreateUUID() is a major part of my bottleneck.

Other tests I've run to confirm that CreateUUID() is the major bottle neck
include:

Looping 500 times using the loopindex to name the thread - but in my
situation not practical (~125ms)

Looping 500 times using RandRange(0,999999) to name the thread - but not
guaranteed unique. (~105ms)

Looping 500 times using CreateUUID() to name the thread - guaranteed to work
but ~16x slower (~1600ms)

Does anyone have any suggestions to reliably replace CreateUUID() for
performance but still remain unique?

TIA

Paul



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288057
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to