部署在Tomcat上的服务在重负载下崩溃

发布于 2025-01-01 01:40:53 字数 589 浏览 0 评论 0原文

我在部署 Tomcat 上的 Web 服务时遇到问题。在高峰流量期间,服务器变得无响应,迫使我重新启动整个服务器才能使其再次工作。

首先,我对这一切都很陌生。我使用各种指南和博客自己构建了服务器。一切都进展顺利,但由于流量负载较大,我现在有点不适应了。因此,我需要关于该做什么的明确指示,或者准确地指出我需要阅读的内容。

我目前正在使用 JavaMelody 监控服务,因此我可以看到出现的峰值,但我不知道如何获取比这更详细的信息,以了解可能的原因/解决方案。

服务器本身是带有 16GB 内存的四核,所以问题不在于那里,更可能的是我需要正确配置 Tomcat 才能使用它(或设置集群......?)

JavaMelody 显示服务cpu使用率只有20%左右就崩溃了,每分钟点击300次左右。我应该配置的内存设置是否有最大连接限制?

我也只部署了该服务的一个实例。我知道我可以简单地重命名 war 文件,Tomcat 会部署第二个实例。这样做会有帮助吗?

每个请求还会打开(并立即关闭)与 mySQL 的连接以检索数据,我可能需要确保它也不会受到限制。

抱歉,这篇文章太长了,并且有多个问题。我可以根据需要提供更多信息,我只是不确定此时需要提供什么!

I'm having trouble with a web service deployed on Tomcat. During peak traffic times the server is becoming non response and forces me to restart the entire server in order to get it working again.

First of all, I'm pretty new to all this. I built the server myself using various guides and blogs. Everything has been working great, but due to the larger load of traffic, I'm now getting out of my league a little. So, I need clear instructions on what to do or to be pointed towards exactly what I need to read up on.

I'm currently monitoring the service using JavaMelody, so I can see the spikes occurring, but I am unaware how to get more detailed information than this as to possible causes/solutions.

The server itself is quad core with 16gb ram, so the issue doesn't lie there, more likely in the fact I need to properly configure Tomcat to be able to use this (or setup a cluster...?)

JavaMelody shows the service crashing when the cpu usage only gets to about 20%, and about 300 hits a minute. Is there any max connection limits of memory settings that I should be configuring?

I also only have a single instance of the service deployed. I understand I can simply rename the war file and Tomcat deploys a second instance. Will doing this help?

Each request also opens (and immediately closes) a connection to mySQL to retrieve data, I probably need to be sure it's not getting throttled there too.

Sorry this is so long winded and has multiple questions. I can give more information as needed, I am just not certain what needs to be given at this time!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日暮斜阳 2025-01-08 01:40:53

服务器有 16G 内存,但是有多少内存专用于 tomcat、-Xms 和 -Xmx?

The server has 16Gs of ram but how much memory do you have dedicated to tomcat, -Xms and -Xmx?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文