tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: How can I limit the number of thread that tomcat spawn for my servlet
Date Fri, 25 May 2007 19:26:30 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Herman,

Herman Schultz wrote:
> My understanding is tomcat will spawn a thread for each request to my
> servlet.

I think you might be misinterpreting this part of the spec. It just says
that each request will be handled by a separate thread. That doesn't
mean that a thread will be created for each request. Most app servers
will use thread pools and re-use threads since they are relatively heavy
to just create and discard all the time.

> How can I limit the number of thread that tomcat spawn for my servlet
> simultaneously?

Tomcat's connector specifies the number of threads that will be created
for request handling. Check out the documentation for the Tomcat connectors:

HTTP: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html
AJP:  http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html

(Note that these are for TC 5.5, so if you are using a different
version, you should use the documentation appropriate for that version).

Specifically, look for settings including the word "thread", as well as
the "backlog" setting. Actually, it's worth reading the whole thing.

> And let say if I limit the simulaneous thread for my servlet to 10, what
> happens to the 11th request? Will it get dropped? Or Will it get queued?

That depends on other settings (such as "backlog"). The links above
should explain everything.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGVzhm9CaO5/Lv0PARAg1IAKC/WUCTjImVABuLokG2NISNypudYQCgl595
ahSYbdx7XAHe27TCPtGaqo4=
=iBTq
-----END PGP SIGNATURE-----

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


Mime
View raw message