简体   繁体   English

Tomcat中的多个Java进程

[英]Multiple java processes in Tomcat

I am working on a web-based application which is deployed in the Tomcat server. 我正在部署在Tomcat服务器中的基于Web的应用程序。 In our local dev enviroemt, when we start the Tomcat server it spawns only one java process which keeps running. 在我们本地的开发环境中,当我们启动Tomcat服务器时,它仅产生一个持续运行的Java进程。 However, an issue has been reported in production where the CPU usage for java process has gone up and there are multiple java processes which have been spawned. 但是,已经在生产中报告了一个问题,其中Java进程的CPU使用率上升,并且产生了多个Java进程。

There is no other java application running, so this must have been spawned from Tomcat itself. 没有其他Java应用程序在运行,因此必须从Tomcat本身产生。 What is the reason that in our development enviroment there is only one java process while in production multiple java processes have been spawned by Tomcat and how to correct it. 是什么原因在我们的开发环境中只有一个Java进程,而在生产环境中Tomcat产生了多个Java进程以及如何纠正它。

Regards, Dev 问候,开发

Unlike Apache HTTPD, Tomcat doesn't spawn processes on its own (it uses multiple threads to serve multiple clients) so you should look elsewhere. 与Apache HTTPD不同,Tomcat不会自行生成进程(它使用多个线程来服务多个客户端),因此您应该在别处查找。 For example, how do you deploy your application to the Tomcat. 例如,如何将应用程序部署到Tomcat。 Could it be something like a buggy deployment script? 可能是错误的部署脚本吗?

Also, what other applications run on this Tomcat container? 另外,还有哪些其他应用程序在此Tomcat容器上运行?

What you see are most likely multiple threads that the version of top or ps shows on the production box, while you don't see them on the local one. 您所看到的很可能是top或ps版本在生产框上显示的多个线程,而您在本地的看不到它们。

In production you most likely face a much higher workload, so that requests are served in parallel, while on the local box Tomcat gets away with less threads. 在生产中,您很可能面临更高的工作量,因此请求可以并行处理,而在本地机器上,Tomcat使用更少的线程就可以摆脱困境。

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

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