I have a Rails app running on rackspace on postgreSQL.
It is really slow.
On special requests it uses up to 4 sec to respond
I have installed new relic.
I can see that for example the index action of some controllers are the slowest. They are really simple with a few finds.
So, I really don’t understand what slows it down.
I wonder if you all can mention some gems that can find performance issues?
I know about bullet, that helps with finding n+1 queries to the database, but that is not my problem.
By request I add the index action of the projects controller(average of 4000 ms response time)
def index
@firm = current_firm
@projects = current_user.projects.is_active
@customers = @firm.customers
@project = Project.new
@todo = Todo.new
end
The is_active method is a scope in the model
scope :is_active, where(["active = ?", true])
From the application controller I have some helpers and before_filters. One of them could be the problem(or something else) That’s why I’d like to have some tools for tracking down performance issues.
Update
looking at the production.log I see
Rendered logs/_list_header.html.erb (0.3ms)
Rendered logs/_log.html.erb (127.7ms)
Rendered private/log_range.js.erb (721.2ms)
Completed 200 OK in 836ms (Views: 733.2ms | ActiveRecord: 43.9ms)
Processing by ProjectsController#index as HTML
Rendered projects/_index.html.erb (4149.8ms)
Rendered projects/index.html.erb within layouts/application (4157.0ms)
Rendered layouts/_header.html.erb (0.3ms)
Completed 200 OK in 6682ms (Views: 4199.6ms | ActiveRecord: 457.0ms)
Processing by LogsController#stop_tracking as JS
Parameters: xxxxx
Rendered logs/_tracking_partial.html.erb (121.1ms)
Rendered logs/_start_tracking.html.erb (6877.9ms)
Rendered logs/_log.html.erb (43.0ms)
Rendered logs/stop_tracking.js.erb (7224.0ms)
Completed 200 OK in 9968ms (Views: 7617.2ms | ActiveRecord: 455.3ms)
look at the last one. A lot of time spent rendering views and js. What can cause this. There is no finds in the views. I just use a instance variable form the controller. And there is less than 20 entries in the database. Could this be caused by a slow internet connection on the computer accessing these views?
The problem was the asset pipeline
I had some css and js files that was not precompiled. I did not get any error messages, but you have to be accurate with the naming. No “.” in the file name and no “.css”
indexing did not help. But, it will probably increase performance when there is more entries in the database.