我如何找出为什么我的 JRuby Rails 应用程序需要很长时间才能提供页面?
我正在使用 Tomcat 来保存我的 Rails 应用程序,但我发现服务请求的时间太长,例如:
Completed 200 OK in 11141ms (Views: 204.0ms | ActiveRecord: 218.0ms)
我想知道为什么花了大约 11 时间秒完成请求。 Views 和 ActiveRecord 只花了 400 毫秒,Rails 在另外 10 秒内做了什么?
I'm using Tomcat to hold my rails application, but I found it took too long to serve a request for example:
Completed 200 OK in 11141ms (Views: 204.0ms | ActiveRecord: 218.0ms)
I'm wondering why it took about 11 seconds to complete the request. Views and ActiveRecord just took 400ms, what was rails doing in other 10 seconds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有比使用分析器更好的调试性能问题的方法了。是的,您可能可以摆脱记录的问题,但设置起来很痛苦,而且并不总是可行,特别是当问题不在您的代码中而是在其他人的代码中时。还有BTrace,但您需要了解很多内部知识,这是耗时且不必要的。
因此,使用分析器,运行 Tomcat 并亲自查看。我更喜欢 YourKit,它的价格是 $$$,但是有 VisualVM 这是免费的。
There is no better way to debug performance problems than using a profiler. Yes, you can probably get away with logging stuff but it's painful to set up and it's not always possible, especially when problems are not in your code but someone else's. There's also BTrace but you need to know lots of internals which is time consuming and unnecessary.
So grab a profiler, run Tomcat and see for yourself. I prefer YourKit which costs $$$, but there's VisualVM which is free.