Rndm
Rndm

Reputation: 6868

Basic tomcat website : threads or processes?

This may be a very basic and simple question for experienced people, but I am a little confused about this :

If there are multiple connections to a website hosted on tomcat, will there be multiple threads or processes or what is the basic mechanism through which the underlying java, jsp code is accessed ?

Upvotes: 2

Views: 1776

Answers (2)

eis
eis

Reputation: 53563

Tomcat uses threads. There's an article on java.net that among other things goes through the most important configuration values:

maxThreads: Tomcat uses a thread pool, and each request will be served by any idle thread in the thread pool. maxThreads decides the maximum number of threads that Tomcat can create to service requests.

minSpareThreads: When Tomcat is initially started, it may not create maxThreads number of threads configured. Instead, it will create minSpareThreads and later, on an as-needed basis, it will create more threads until the number of threads reaches a maximum of maxThreads.

maxSpareThreads: During off-load times, Tomcat doesn't require many of the threads in the pool. maxSpareThreads is the maximum number of idle threads Tomcat will retain in the pool. If this number is exceeded, excess threads are de-referenced to allow garbage collection.

I'd recommend checking out the article.

Upvotes: 4

Aleksander Blomskøld
Aleksander Blomskøld

Reputation: 18562

The servlet container (Tomcat) maintains a thread pool which it uses to serve the requests. Tomcat never forks new processes.

Upvotes: 2

Related Questions