gpt4 book ai didi

ruby-on-rails - 如何识别 Rails 应用程序中的慢行?

转载 作者:数据小太阳 更新时间:2023-10-29 07:39:22 24 4
gpt4 key购买 nike

我有一个运行在 4.1.6 和 Ruby 2.1.3 上的 Rails 应用程序。有时在某些请求上他们需要很长时间,但并非总是如此。当我检查 newrelic 时,我仍然无法识别或追踪慢度线。

enter image description here enter image description here

最佳答案

查看 perftools - 您可以使用 googles perftools,或 ruby specific implementation .关于它有一篇很好的文章 here

它贯穿您的应用程序并通过确定各个方法调用所花费的时间来发现瓶颈。你会得到这样的输出:

Total: 23 samples
18 78.3% 78.3% 18 78.3% BigDecimal#div
4 17.4% 95.7% 4 17.4% BigDecimal#*
1 4.3% 100.0% 23 100.0% BigMath#PI
0 0.0% 100.0% 23 100.0% BigMath.PI

在这种情况下,您需要花一些时间查看 BigDecimal 中的 div 方法

关于ruby-on-rails - 如何识别 Rails 应用程序中的慢行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26590126/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com