Rails Admin的生产速度异常慢

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

我正在使用Rails API在docker生产环境中运行Rails Admin。由于某些原因,渲染速度非常慢。一个简单的页面加载需要15秒钟,看来布局的渲染要花费非常长的时间。

我是否忘了在Docker构建过程中的某个地方编译资产,这是造成这种情况的原因?

User Load (18.8ms)  SELECT "users".* FROM "users" ORDER BY users.id desc LIMIT $1 OFFSET $2  [["LIMIT", 20], ["OFFSET", 0]]
    (20.8ms)  SELECT COUNT(*) FROM "users"
    Rendered /usr/local/bundle/gems/rails_admin-2.0.2views/rails_admin/main/index.html.haml within layouts/rails_admin/application (Duration: 1559.2ms | Allocations: 49878)
    Rendered /usr/local/bundle/gems/rails_admin-2.0.2views/layouts/rails_admin/_head.html.haml (Duration: 0.5ms | Allocations: 190)
    Rendered /usr/local/bundle/gems/rails_admin-2.0.2views/layouts/rails_admin/_secondary_navigation.html.haml (Duration: 0.5ms | Allocations: 269)
    Rendered /usr/local/bundle/gems/rails_admin-2.0.2views/layouts/rails_admin/_navigation.html.haml (Duration: 3.2ms | Allocations: 469)
    Rendered /usr/local/bundle/gems/rails_admin-2.0.2views/layouts/rails_admin/_sidebar_navigation.html.haml (Duration: 35.2ms | Allocations: 17042)
    Rendering /usr/local/bundle/gems/rails_admin-2.0.2views/layouts/rails_admin/pjax.html.haml
    Rendered /usr/local/bundle/gems/rails_admin-2.0.2views/layouts/rails_admin/pjax.html.haml (Duration: 12.1ms | Allocations: 1683)
    Completed 200 OK in 2302ms (Views: 1590.1ms | ActiveRecord: 120.6ms | Allocations: 77826)
ruby-on-rails docker rails-admin
1个回答
0
投票

根据Github上的this issue,您可以尝试像这样禁用统计信息

RailsAdmin.config do |c|
  c.actions do
    dashboard do
      statistics false
    end
  end
end

此文档的全文为here

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