【发布时间】:2019-12-21 00:57:48
【问题描述】:
我们已完成将应用从 Rails 4.2 升级到 5.2。当我们在 5.2 版本上运行负载测试时,它只能处理 4.2 版本的一半负载。在负载测试期间查看 NewRelic 统计数据时,似乎到处都变慢了——几乎每个请求、ActiveRecord 调用、redis 调用、ruby 等。我们已经确认它与另外发生的其他升级无关——ruby 升级、升级pg gem,或升级 puma。在研究过程中,我发现与升级相关的唯一性能问题已得到修复。
有没有人遇到过类似的情况或有关于在哪里寻找的指示?
到目前为止我们所做的尝试:
1. Check non-rails related upgrades that happened at the same time:
- Upgrade 4.2 branch to same version of ruby to see if that has any impact (no impact)
- Downgrade puma and pg gems in Rails 5 branch (no impact)
2. Examine performance traces for slower transactions and DB queries. Remove the slowest interactions from the load test to see if the overall slowest continues (it does).
3. Test if slowness appears in Rails 5.1 (it does).
我们打算尝试什么:
1. Test if slowness appears in Rails 5.0.
2. See if slowest can be detected in single user use rather than load test.
3. Use https://github.com/tleish/ruby-prof-rails to see if we can get more statistics to examine.
4. Downgrade all gems except the ones we absolutely need for the Rails 5 upgrade and see if problem still exists.
【问题讨论】:
-
有太多的事情会影响性能——像对待任何其他性能问题一样对待它,检查更改日志,进行正常的性能跟踪等。对您的系统、应用程序或任何东西的了解为零,没有办法提供帮助,而且 SO 并不是解决此类过于广泛的问题的最佳场所。
-
您如何确认它与其他升级无关?你试过剖析吗? automated performance checks 和 Rails audits 怎么样?
-
这真的很宽泛,为了保持问题的开放性,请您选择最重要的性能问题,以便我们提供帮助吗?我知道这是您的应用程序中的一个普遍问题,但原因可能太多了。如果我们瞄准一个,我们可能会找到一切的根本原因。
-
戴夫和汤姆:公平点关于它的广泛性。重点实际上是强调 Rails 5 升级的内容。经过几天的侦查,我们只知道它不是什么,但不是它是什么。
-
Schwern:我们通过在没有升级的情况下运行相同的测试确认它与其他升级无关,并且看到了相同的结果。
标签: ruby-on-rails performance ruby-on-rails-5