如何使用 Ruby New Relic 代理获取更详细的事务跟踪
我正在 Heroku 上运行 Rails 3.0 应用程序并使用 New Relic 插件/服务。
我一直在研究事务跟踪功能(专业版中提供),以更多地了解应用程序的性能特征。然而,很大一部分时间(30-50%)是“未使用工具的时间”。在通过将 method_tracers 放在某些地方并经历相当慢的周期来测试我是否获得更多信息进行了一些尝试之后,我觉得这不会很快发生。
看来 PHP new relic 代理有一个很棒的功能,可以获取非常详细的跟踪,而无需猜测方法跟踪器的位置: http://newrelic.com/docs/php/php-agent-faq#top100
ruby 有类似的东西吗?
注意:我已经在使用 rpm_contrib 来获取更多信息并启用了垃圾收集统计信息。此外,这并不是要解决性能问题,只是了解如何更好地使用可用的性能工具,并解决那些未检测的时间的烦恼。
I'm running a rails 3.0 application on Heroku and using the New Relic addon/service.
I have been looking at the transaction traces feature (available in the pro version) to understand a little more about the performance characteristics of the application. However, a significant portion of time (30-50%) is "uninstrumented time". After making a few stabs by putting method_tracers in some places and going through the reasonably slow cycle to test whether I get more info, I'm feeling this is going nowhere fast.
It seems in the PHP new relic agent they have a great feature to get very detailed traces without needing to guess where to put method tracers: http://newrelic.com/docs/php/php-agent-faq#top100
Is there anything similar to this for ruby?
Note: I'm already using rpm_contrib to get some more info and have garbage collection stats enabled. Also, this is not about fixing a performance problem, just understanding how to better use the performance tools available and scratch a niggling itch about that uninstrumented time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前 Ruby 还没有类似的东西。当我有机会时,我会向 Ruby 工程师提及这一点。我的猜测是,除非收到大量请求,否则它暂时不会出现在列表的顶部。同时,您可以使用方法跟踪器来计算未检测的时间。
希望有帮助。
There isn't currently anything similar for Ruby. I'll mention it to the Ruby engineer when I get a chance. My guess is unless a lot of requests come in for it, it won't be at the top of the list for a while, though. In the meantime, you can use the method tracers to figure out the uninstrumented time.
Hope that helps.
方法跟踪器可以很好地工作,但如果控制器中有很多代码,请尝试使用trace_execution_scoped进行二分搜索,它记录代码块中花费的时间:
http://newrelic.github.com/rpm/NewRelic/Agent/MethodTracer/InstanceMethods/TraceExecutionScoped.html#method-i-trace_execution_scoped
对此添加几个调用,为每个指标指定一个合理的名称,如“Custom/MySlowControllerAction/block0”(trace_execution_scoped 的第一个参数),然后重复。
您命名的指标不仅会显示在“事务跟踪”中,还会显示在“Web 事务”选项卡下控制器操作的“性能细分”中,因此您将看到该代码块中所有请求的平均时间,而不仅仅是缓慢的请求。
Method tracers can work well, but if you have a lot of code in your controller, try a binary search using trace_execution_scoped, which records the time spent in a block of code:
http://newrelic.github.com/rpm/NewRelic/Agent/MethodTracer/InstanceMethods/TraceExecutionScoped.html#method-i-trace_execution_scoped
Add a couple calls to this, give each metric a sensible name like "Custom/MySlowControllerAction/block0" (first argument to trace_execution_scoped), and repeat.
The metrics you name will show up not just in Transaction Traces, but also in the Performance Breakdown for the controller action under the Web Transactions tab, so you'll see average time in that block of code across all requests, not just the slow ones.