Rails 5升级后性能大幅下降

问题描述 投票:4回答:1

我们已完成将我们的应用程序从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.
ruby-on-rails performance ruby-on-rails-5
1个回答
0
投票

这最终是Rack :: Timeout,Heroku和Puma的组合。在重负载下,有时我们会达到28秒的Rake :: Timeout值。出于某种原因,升级后,Rake :: Timeout值与Heroku的30秒路由器超时(H12)之间的2秒还不够。结果,在Rake :: Timeou之前,进程被Heroku杀死,这导致Puma中的级联效应,使同一服务器上的大量其他请求也超时。我们通过将Rake :: Timeout值调整为25秒来修复它,并且一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.