Tomcat 上的 Jruby Rails 应用程序 CPU 使用率峰值
这也可能属于服务器故障。这是服务器配置和代码之间的组合(我认为)
这是我的设置:
Rails 2.3.5 app running on jruby 1.3.1
Service Oriented backend over JMS with activeMQ 5.3 and mule 2.2.1
Tomcat 5.5 with opts: "-Xmx1536m -Xms256m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"
Java jdk 1.5.0_19
Debian Etch 4.0
运行 top
,每次我单击网站上的链接时,我都会看到我的 java
进程CPU 使用率激增。如果是小页面,有时只有 10% 使用率,但有时在更复杂的页面上,我的 CPU 会上升到 44%(从来没有高于,不知道为什么)。在这种情况下,一个请求可能需要几分钟的时间,而我的服务器的平均负载
会稳步攀升至 8 或更高。这只需单击一个链接即可加载来自某些服务的一些请求,没有什么太复杂的。 java进程内存大部分时间徘徊在20%左右。
如果我离开一会儿,平均负载就会回到零。再点击几个链接,就会爬回来。
我正在为 Rails 前端运行一个小型亚马逊实例,并为所有服务运行一个大型实例。
现在看来,这显然是不可接受的。单个用户可以将平均负载峰值提高到 8,并且在两个人使用它的情况下,它可以在我们使用该网站的期间保持该平均负载。我想知道我可以做什么来检查发生了什么?我完全不知道如何调试它。 (当我通过 jruby 运行 Rails 应用程序时,它不会在本地发生,而不是在 tomcat 容器内)
有人可以告诉我如何检查我的 jruby 应用程序以找出它如何可能耗尽如此巨大的资源吗?
请注意,我之前注意到了这一点,似乎是随机的,但现在,从 Rails 2.2.2 升级到 2.3.5 后,我一直看到它,它使网站完全无法使用。
非常感谢任何有关在哪里查看的提示。我什至不知道从哪里开始。
This might also belong on serverfault. It's kind of a combo between server config and code (I think)
Here's my setup:
Rails 2.3.5 app running on jruby 1.3.1
Service Oriented backend over JMS with activeMQ 5.3 and mule 2.2.1
Tomcat 5.5 with opts: "-Xmx1536m -Xms256m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"
Java jdk 1.5.0_19
Debian Etch 4.0
Running top
, every time i click a link on my site, I see my java
process CPU usage spike. If it's a small page, it's sometimes just 10% usage, but sometimes on a more complicated page, my CPU goes up to 44% (never above, not sure why). In this case, a request can take upwards of minutes while my server's load average
steadily climbs up to 8 or greater. This is just from clicking one link that loads a few requests from some services, nothing too complicated. The java process memory hovers around 20% most of the time.
If I leave it for a bit, load average goes back down to nothing. Clicking a few more links, climbs back up.
I'm running a small amazon instance for the rails frontend and a large instance for all the services.
Now, this is obviously unacceptable. A single user can bring spike the load average to 8 and with two people using it, it maintains that load average for the duration of our using the site. I'm wondering what I can do to inspect what's going on? I'm at a complete loss as to how I can debug this. (it doesn't happen locally when I run the rails app through jruby, not inside the tomcat container)
Can someone enlighten me as to how I might inspect on my jruby app to find out how it could possibly be using up such huge resources?
Note, I noticed this a little bit before, seemingly at random, but now, after upgrading from Rails 2.2.2 to 2.3.5 I'm seeing it ALL THE TIME and it makes the site completely unusable.
Any tips on where to look are greatly appreciated. I don't even know where to start.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保 Tomcat 和其他东西之间没有意外的通信。我会首先检查是否:
这种不必要的负载可能是由于处理来自另一个应用程序的消息而导致的。
Make sure that there is no unexpected communication between the Tomcat and something else. I would check in the first place if:
This unnecessary load may result from the processing of the messages coming from another application.