Re: Using CFTHREAD on CF PRO

2011-05-18 Thread Judah McAuley

Instead of going the route of using cfthread, I would suggest that you
might looking into using a queue to handle this. There are a lot of
queue options out there ( I believe that Railo uses ActiveMQ for a
bunch of things internally, don't know about Adobe) but the essential
idea is that you push a message onto the queue at the end of your
request (onRequestEnd) and then you have an asynchronous worker
process that monitors the queue, pulls messages off as they show up
and then processes them. If you start seeing a big spike in traffic
and need to pull the messages off the queue more quickly, you can
increase the number of workers. If time isn't a particularly big
issue, you can just let the one worker go and the messages will all be
dealt with eventually.

Cheers,
Judah

On Tue, May 17, 2011 at 7:56 AM, Brook Davies  wrote:
>
> Hi Guys,
>
>
>
> I am considering spawning a new thread via the onRequestEnd event to do some
> post processing. Basically its going to record some stats (a couple quick DB
> queries) and possibly send an email based on some criteria. I am considering
> CFTHREAD because the user does not need to wait for any results of this
> processing.
>
>
>
> I've read some things about CFTHREAD being a bottle neck and that CF
> Proffesional has limited threads. Would I be asking for trouble trying to do
> this? Should I just let the user wait for the processing to finish? It would
> really like only be 100-200 milliseconds or so
>
>
>
> Brook
>

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344618
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Using CFTHREAD on CF PRO

2011-05-17 Thread Andrew Scott

Although what Dan is saying is correct, one can think a little about this.

Let's say we have a hundred requests come in at the same time, and for 
arguments sake we have a limitation of 2 running threads for ColdFusion 
standard. This means that you have 98 queued up ready to be processed, 49 to 
the power of 200ms which is 2401ms. That is almost 3 secs to process the 
threads.

That might not be anything to worry about for a very low impact site, so you 
will need to take this into consideration with whatever method you decided. 
Personally with this type of restriction on ColdFusion Standard I would be more 
inclined to waste the 200ms on the user request, rather than bogging the server 
down for scalability reasons.

Just something to think about.


Regards,
Andrew Scott
http://www.andyscott.id.au/


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344610
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Using CFTHREAD on CF PRO

2011-05-17 Thread Dan G. Switzer, II

Brook,

On Tue, May 17, 2011 at 10:56 AM, Brook Davies  wrote:

> I am considering spawning a new thread via the onRequestEnd event to do
> some
> post processing. Basically its going to record some stats (a couple quick
> DB
> queries) and possibly send an email based on some criteria. I am
> considering
> CFTHREAD because the user does not need to wait for any results of this
> processing.
>
> I've read some things about CFTHREAD being a bottle neck and that CF
> Proffesional has limited threads. Would I be asking for trouble trying to
> do
> this? Should I just let the user wait for the processing to finish? It
> would
> really like only be 100-200 milliseconds or so
>

This is really one of those situations where running a load test really
gives you the best answer. You may end up getting a variety of answers, but
none will be quite as useful as spending 30-60 minutes running a simple load
test to see what happens.

If you don't currently have any tools for running a load test, download Apache
jMeter  and then you can follow this
tutorial:

http://www.roseindia.net/jmeter/using-jmeter.shtml

Set up a simple test what the results are between using  and not
using it in your onRequestEnd and see what the impact is on your site under
various types of load. If you set up the Aggregate Report listener it'll
give you an idea of the overall impact.

I use jMeter a lot when I want to quickly see what the real impact of under
load of some code might be. I usually will set things up so that a URL
parameter can toggle various code branches--that way I can quickly change
the behavior right from jMeter. I'll run several tests simulate heavy load
and see which performs better overall and to see if any of the solutions are
causing weird queuing issues.

-Dan

-- 
Dan G. Switzer, II
dswit...@pengoworks.com
http://blog.pengoworks.com/

█▀▀▀▀▀█ ▄▀ ▄█▄▄█  █▀▀▀▀▀█
█ ███ █ ▀███▀ █▀  █ ███ █
█ ▀▀▀ █ █▄ ▄  ▀██ █ ▀▀▀ █
▀▀▀▀▀▀▀ █▄▀ █ █ ▀ ▀▀▀▀▀▀▀
█▀▄█▄▄▀▀  █▄▀██ █▄█▀▀ ▀▀▄
 ▄▀█▄▀▀▀▄▀▀▄▄▄█ ▄█▄▀▀  ▀▀
▀▀▄▄▀▀▀▀█▄▄▀▀█ ▀▀██▄ █▄▀█
▀▄ ▄▀ ▀  ▀▀█▄█▄▄▄ █▄▀▄▀▄▀
▀▀ ▀▀ ▀ █▀ ██▄ ▄█▀▀▀███ ▄
█▀▀▀▀▀█ ▀▄█ ▄▀█▀█ ▀ █▄▄▀█
█ ███ █ ▄▀▀ █▀ ▄▀█▀██ ▄▀
█ ▀▀▀ █ ▄ █▄ ▄▄ ▄▄▄ ▀█▀ ▀
▀▀▀▀▀▀▀ ▀▀  ▀▀ ▀▀  ▀   ▀▀


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344576
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Using CFTHREAD on CF PRO

2011-05-17 Thread Andrew Scott

If it is only going to be at max 1/5 of a second I don't see a thread making
any difference to overall page processing time. You will end up adding more
depending on concurrent connections, by using the cfhthread on standard
edition of ColdFusion. As each thread will be queued up for each connection,
so a user could end up waiting 5 seconds in the queue.

Regards,
Andrew Scott
http://www.andyscott.id.au/



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344570
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Using CFTHREAD on CF PRO

2011-05-17 Thread Brook Davies

Hi Guys,

 

I am considering spawning a new thread via the onRequestEnd event to do some
post processing. Basically its going to record some stats (a couple quick DB
queries) and possibly send an email based on some criteria. I am considering
CFTHREAD because the user does not need to wait for any results of this
processing.

 

I've read some things about CFTHREAD being a bottle neck and that CF
Proffesional has limited threads. Would I be asking for trouble trying to do
this? Should I just let the user wait for the processing to finish? It would
really like only be 100-200 milliseconds or so 

 

Brook

 




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344569
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm