tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G. Wade Johnson" <wade.john...@abbnm.com>
Subject Re: [Q] Is it safe to create threads in Tomcat web-apps?
Date Mon, 28 Jul 2003 14:07:18 GMT
I hate to speak for someone else, but I believe that Tim may have been
referring to the tendency of some people to use threads without
understanding their limitations. (I've seen attempts to massively
thread CPU-bound applications on single CPU machines.)

Threads are not magic that can be spread on a program to make it
"better".

That being said. Tim did not say "don't" he asked "why".<grin/> That's
much politer than I've normally been to people in a similar
circumstance.
<shrug/>

G. Wade

srevilak@g88.net wrote:
> 
> > From: Tim Funk <funkman () joedog ! org>
> > Subject: Re: [Q] Is it safe to create threads in Tomcat web-apps?
> 
> > You can create threads all day in tomcat, but here are the importnatn things
> > to consider:
> 
> > - WHY! Are threads really the correct solution?
> > - And last but not least: WHY! Are threads really the correct solution?
> 
> I'm getting the impression that you think multiple threads are never
> the right answer.  :) That's not necessarily true.
> 
> Suppose that your response to a request contains three steps which are
> independant of one another; in order to deliver a faster response
> time, you'd like to execute them concurrently.
> 
> If these three steps are CPU-bound, then the amount of benefit really
> depends on the machine; you need multiple CPUs so that the scheduler
> can run the different threads on different CPUs.  With a single CPU,
> you're not likely to see much benefit.
> 
> However, if the three steps are IO-bound, using multiple threads to
> run them concurrently can lead to a big improvement.  Most of the time
> spent doing IO is spent waiting.  (Particularly if the IO is network
> IO, a "sub-request" to a remote site, for example).  If the idle times
> occur concurrently instead of serially, you'll certainly do better.
> 
> --
> Steve
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message