You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by William Crowell <WC...@perforce.com.INVALID> on 2023/12/05 19:29:11 UTC

Thread Pool Question

If I create a separate thread pool in Tomcat’s server.xml like this:

<Executor name="myAppThreadPool" namePrefix="my-app-thread-exec-" maxThreads="150" minSpareThreads="25"/>

Then how do I get a thread to assign any work to it?

Regards,

William Crowell


This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.


RE: Thread Pool Question

Posted by Jo...@wellsfargo.com.INVALID.
You have to refer to it in your connector:

https://tomcat.apache.org/tomcat-10.0-doc/config/http.html


> -----Original Message-----
> From: William Crowell <WC...@perforce.com.INVALID>
> Sent: Tuesday, December 5, 2023 1:39 PM
> To: Tomcat Users List <us...@tomcat.apache.org>
> Subject: Re: Thread Pool Question
> 
> I should clarify the ask here...
> 
> I have some long running JDBC queries against Oracle, and I do not want to
> tie up Tomcat's web thread pool with them.  I would only have between 1-10
> threads in this pool.
> 
> Regards,
> 
> William Crowell
> 
> 
> 
> 
> This e-mail may contain information that is privileged or confidential. If you
> are not the intended recipient, please delete the e-mail and any attachments
> and notify us immediately.


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


Re: Thread Pool Question

Posted by Deepak Lalchandani <de...@gmail.com>.
Hi Tomcat users,
                              Can you share the jsp code of thread pool so
that I can analyse it

Thanks and Regards,
Deepak

On Wed, 6 Dec 2023, 8:46 pm Christopher Schultz, <
chris@christopherschultz.net> wrote:

> William,
>
> On 12/5/23 14:39, William Crowell wrote:
> > I should clarify the ask here…
> >
> > I have some long running JDBC queries against Oracle, and I do not
> > want to tie up Tomcat’s web thread pool with them.  I would only have
> > between 1-10 threads in this pool.
>
> Executors aren't directly-accessible by applications. If you want to
> off-load processing to another thread, you'll have to maintain your own
> thread-pool.
>
> If you are using plain-old servlet dispatching, then off-loading to
> another thread won't save you anything: your request-processing thread
> will have to wait on your database-processing thread to complete before
> returning a response. It sounds like what you really want is
> servet-async where you put the request to sleep while you do something
> time-consuming and let the request-processing thread go back into the pool.
>
> If you really are running the thread in the background, say, across
> requests, then you can do this with a thread pool that you, say, store
> in the application scope. I've done this myself, and end up storing a
> "progress object" in the user's session so that any subsequent request
> can check on the status of the long-running process.
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Thread Pool Question

Posted by Christopher Schultz <ch...@christopherschultz.net>.
William,

On 12/5/23 14:39, William Crowell wrote:
> I should clarify the ask here…
> 
> I have some long running JDBC queries against Oracle, and I do not
> want to tie up Tomcat’s web thread pool with them.  I would only have
> between 1-10 threads in this pool.

Executors aren't directly-accessible by applications. If you want to
off-load processing to another thread, you'll have to maintain your own 
thread-pool.

If you are using plain-old servlet dispatching, then off-loading to 
another thread won't save you anything: your request-processing thread 
will have to wait on your database-processing thread to complete before 
returning a response. It sounds like what you really want is 
servet-async where you put the request to sleep while you do something 
time-consuming and let the request-processing thread go back into the pool.

If you really are running the thread in the background, say, across 
requests, then you can do this with a thread pool that you, say, store 
in the application scope. I've done this myself, and end up storing a 
"progress object" in the user's session so that any subsequent request 
can check on the status of the long-running process.

-chris

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


Re: Thread Pool Question

Posted by William Crowell <WC...@perforce.com.INVALID>.
I should clarify the ask here…

I have some long running JDBC queries against Oracle, and I do not want to tie up Tomcat’s web thread pool with them.  I would only have between 1-10 threads in this pool.

Regards,

William Crowell




This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.