我正在使用Rails 3.0.7,kaminari gem。
我刚刚建立了一个简单的网站,包含SQLite数据库和100,000行数据,只有四列(ID
,name
,created_at
,updated_at
)。< / p>
这是我的控制者:
class HclinksController < ApplicationController
# GET /hclinks
# GET /hclinks.xml
def index
@hclinks = Hclink.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @hclinks }
end
end
end
我搭建了它。
这是我的日志:
// THIS IS INDEX, WHICH SHOWS ALL THE LIST ITEMS
Started GET "/hclinks" for 127.0.0.1 at 2011-05-08 00:59:52 +0800
Processing by HclinksController#index as HTML
Hclink Load (391.8ms) SELECT "hclinks".* FROM "hclinks" LIMIT 25 OFFSET 0
SQL (4574.8ms) SELECT COUNT(*) FROM "hclinks"
Rendered hclinks/index.html.erb within layouts/application (178778.1ms)
Completed 200 OK in 182775ms (Views: 175845.5ms | ActiveRecord: 4966.6ms)
// THIS IS THE RUBY ON RAILS WELCOME PAGE
Started GET "/hclinks" for 127.0.0.1 at 2011-05-08 01:03:13 +0800
Processing by HclinksController#index as HTML
Hclink Load (65.3ms) SELECT "hclinks".* FROM "hclinks" LIMIT 25 OFFSET 0
SQL (910.6ms) SELECT COUNT(*) FROM "hclinks"
Rendered hclinks/index.html.erb within layouts/application (1532.2ms)
Completed 200 OK in 1657ms (Views: 652.5ms | ActiveRecord: 975.9ms)
我想知道为什么列表需要这么长时间来回复...我应该如何修复它?谢谢!
答案 0 :(得分:0)
这个日志输出是重新启动rails还是应用程序已经运行了一些请求?
如果这不是第一个请求,我会检查每个请求的加载时间是否增加。
如果是,则可能发生内存泄漏