Apache Tomcat是否为每个部署的WAR启动新进程?

时间:2021-10-01 04:09:36

When I deploy (and start) two WAR files on one Tomcat instance, how many Java processes will there be? In other words, will the threads handeling requests to the respective context roots fall under the same process, or will each thread pool fall under a sparate process?

当我在一个Tomcat实例上部署(并启动)两个WAR文件时,会有多少个Java进程?换句话说,处理对相应上下文根的请求的线程是否属于同一进程,或者每个线程池是否属于sparate进程?

2 个解决方案

#1


The Tomcat application server deploys all webapps into a single JVM by default.

默认情况下,Tomcat应用程序服务器将所有Web应用程序部署到单个JVM中。

However you can have multiple tomcat instances which can run their own JVM and have separate configurations and can be started/stopped independently.

但是,您可以拥有多个tomcat实例,这些实例可以运行自己的JVM并具有单独的配置,并且可以独立启动/停止。

Tomcat has had the ability to define and run multiple instances from a single copy of a binary distribution, and this functionality is well documented in the file RUNNING.txt at the root of the Tomcat binary distribution file hierarchy

Tomcat能够从二进制发行版的单个副本定义和运行多个实例,并且在Tomcat二进制发布文件层次结构的根目录下的文件RUNNING.txt中详细记录了此功能。

Source

RUNNING.TXT example

Run multiple tomcat instances example

运行多个tomcat实例示例

#2


From what I know there is a thread pool created per Connector. Although, you can implement an Executor, which will allow to share a thread pool. The Executor element has to appear prior to Connector element in server.xml

据我所知,每个连接器创建一个线程池。虽然,您可以实现一个Executor,它将允许共享一个线程池。 Executor元素必须出现在server.xml中的Connector元素之前

#1


The Tomcat application server deploys all webapps into a single JVM by default.

默认情况下,Tomcat应用程序服务器将所有Web应用程序部署到单个JVM中。

However you can have multiple tomcat instances which can run their own JVM and have separate configurations and can be started/stopped independently.

但是,您可以拥有多个tomcat实例,这些实例可以运行自己的JVM并具有单独的配置,并且可以独立启动/停止。

Tomcat has had the ability to define and run multiple instances from a single copy of a binary distribution, and this functionality is well documented in the file RUNNING.txt at the root of the Tomcat binary distribution file hierarchy

Tomcat能够从二进制发行版的单个副本定义和运行多个实例,并且在Tomcat二进制发布文件层次结构的根目录下的文件RUNNING.txt中详细记录了此功能。

Source

RUNNING.TXT example

Run multiple tomcat instances example

运行多个tomcat实例示例

#2


From what I know there is a thread pool created per Connector. Although, you can implement an Executor, which will allow to share a thread pool. The Executor element has to appear prior to Connector element in server.xml

据我所知,每个连接器创建一个线程池。虽然,您可以实现一个Executor,它将允许共享一个线程池。 Executor元素必须出现在server.xml中的Connector元素之前