我怎样才能完整地剖析Rails应用程序,而不仅仅是控制器? [英] How can I profile a Rails app in its entirety, not just controllers?
问题描述
可能存在重复:
你推荐哪些工具来描述Rails应用? b
我的Rails应用程序需要大约2秒才能响应POST请求,我无法弄清楚原因。当我使用像newrelic这样的传统分析工具或挂钩到单元测试中的东西时,他们告诉我,我的所有请求都很快,时间不到20毫秒。但是当我真正计时的时候,他们需要2秒钟。 GET请求很快。这发生在开发和生产模式,使用杂种。所以我怀疑有些宝石是在做不必要的工作。我怎样才能追踪到这一点?如果这是一些其他类型的服务器而不是Rails,那么我只是简单介绍一下正在运行的服务器,但Rails分析解决方案似乎只是描述了控制器代码。
解决方案
众所周知的 ruby-prof 可能对您有所帮助。您的Rails应用程序的config.ru文件将为您提供一些手动运行应用程序的提示。
其他替代方法请看此问题。
Possible Duplicate:
What tools do you recommend to profile Rails apps?
My rails app is taking ~2 seconds to respond to POST requests, and I can't figure out why. When I use traditional profiling tools like newrelic or things that hook into unit tests, they tell me that all of my requests are fast, taking under 20 ms. But when I actually time the requests, they are taking 2 seconds. GET requests are fast. This happens in both development and production mode, using mongrel. So my suspicion is that some gem is doing needless work. How can I track this down? If this was some other sort of server rather than Rails, I would just profile the running server, but the Rails profiling solutions all seem to just profile the controller code.
The well know ruby-prof may help you. The config.ru file of your rails app will give you some hints on running the app manually.
For other alternatives take a look at this question.
这篇关于我怎样才能完整地剖析Rails应用程序,而不仅仅是控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!