简体   繁体   English

Spring Boot嵌入式Tomcat或未嵌入式Tomcat

[英]Spring Boot embedded tomcat or not embedded tomcat

When I use embedded tomcat to run Spring Boot Application,the tomcat instance will +1. 当我使用嵌入式tomcat运行Spring Boot Application时,tomcat实例将+1。 I run another embedded tomcat Spring Boot Application one the same server,the tomcat instance will +2. 我在同一台服务器上运行另一个嵌入式tomcat Spring Boot Application,该tomcat实例将增加2。 I wonder if the embedded tomcat will cost much resource. 我想知道嵌入式tomcat是否会花费很多资源。

On the Contrary, not embedded tomcat only exist one instance on the server for many Spring Boot Application. 相反,没有嵌入的tomcat只在服务器上存在许多Spring Boot Application实例。

Is this a vaild idea? 这是一个无效的主意吗?

Deploying into one tomcat requires less resources, than running multiple apps with an embedded tomcat. 与运行带有嵌入式tomcat的多个应用程序相比,部署到一个tomcat所需的资源更少。 How to deploy often also depends on other requirements : 通常如何部署还取决于其他要求:

For production environment I am mostly forced to deploy into a tomcat. 对于生产环境,我大多被迫部署到tomcat中。 Operators prefer this, its their common way to run java apps and gives more tuning options. 运营商更喜欢它,这是它们运行Java应用程序的常见方式,并提供了更多的调整选项。

Developers run embedded tomcats locally, it allows faster deployment cycles and easier debugging. 开发人员在本地运行嵌入式tomcat,它可以加快部署周期并简化调试。

When apps run in a cloud, it may be cheaper to use one tomcat for many apps. 当应用程序在云中运行时,对于许多应用程序使用一个tomcat可能会更便宜。

I would recommend to support both, creating a war for tomcat and a jar with an embedded tomcat as well. 我建议同时支持这两种方法,同时也要为tomcat和带有嵌入式tomcat的jar创建战争。 Use spring and maven profiles to provide different configs for both environments. 使用spring和maven配置文件为两种环境提供不同的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM