Fred, I took your suggestion to up the log level and this is what it reveals:
Processing UsersController#index [GET] Parameters: {"action"=>"index", "controller"=>"users", "page"=>"11"} User Load (26.0ms) SELECT * FROM `users` ORDER BY users.created_at DESC LIMIT 100, 10 SQL (0.2ms) SELECT count(*) AS count_all FROM `users` Rendering template within layouts/application Rendering users/index Rendered users/_user (3.7ms) Rendered users/_user (2.9ms) Rendered users/_user (3.1ms) Rendered users/_user (42.6ms) Rendered users/_user (39.6ms) Rendered users/_user (121.2ms) Rendered users/_user (32.9ms) Rendered users/_user (4.9ms) Rendered users/_user (14.7ms) Rendered users/_user (2.7ms) User Load (0.2ms) SELECT * FROM `users` WHERE (`users`.`id` = 1) LIMIT 1 Rendered users/_search (3.0ms) Rendered users/_user_bar (2.1ms) Completed in 319ms (View: 288, DB: 27) However, once I hit refresh a bunch of times, all those partials drop to only a few ms each. Including the ones that show as 40, 120, etc above. Those long ones all had text in the about_me.... -Avishai On Apr 6, 1:37 pm, Avishai <avishai.we...@gmail.com> wrote: > Interesting. Maybe something is going on in the controller. I've tried > running the resulting SQL queries directly, and they still seem to be > fetching pretty quickly... > > The controller contains a lot of conditionals, maybe that's the issue? > I've used Newrelic RPM to analyze my SQL, and it looks like for > everything there's no USING FILESYSTEM, so indexes are set up > properly... The about_me column is a regular freetext column (TEXT i > think), so the length varies anywhere from zero to a few paragraphs of > text. The photos are handled with paperclip, but are just URLs, not > the actual files in the DB. Could it still be a bandwidth still be an > issue DB => webserver if they're on the same box? > > Controller code is at the end here:http://gist.github.com/90786 > > Cheers, > > Avishai > > On Apr 6, 12:50 pm, Harold <harold.gime...@gmail.com> wrote: > > > I can't find anything fundamentally wrong on your views, but we > > haven't seen any controller and model code. > > > Try benchmarking/profiling your app to find out exactly what the > > bottleneck is. Seehttp://guides.rubyonrails.org/performance_testing.html > > > A good start may be your DB. What RDMS are you using? Do you have > > proper indexes? > > Have you tried running the SQL directly (pick it up from the logs) and > > finding out if it's a problem with Rails at all? > > How big is the user.about_me column be? If it's huge you may be > > hitting a bandwidth bottleneck (DB => web server). > > > Not much more occurs to me at this point, but hope that points you on > > the right direction. > > > On Apr 6, 11:14 am, Avishai <avishai.we...@gmail.com> wrote: > > > > Hi, > > > > I've been experiencing some severe slowness in rendering the views in > > > my users/index action. It's really not doing anything fancy at all, > > > and has been driving me nuts the last few days. I'm running Rails > > > 2.2... does anyone have any idea how to resolve this? Look at home > > > much time is being consumed by the view. Obviously those response > > > times are unacceptable, and this is with 3 instances of Thin running > > > in production on a VPS... > > > > #production.log > > > Rendering users/index > > > Completed in 11386ms (View: 8693, DB: 151) > > > > Rendering users/index > > > Completed in 5024ms (View: 3286, DB: 16) > > > > Rendering users/index > > > Completed in 11692ms (View: 8811, DB: 105 > > > > Rendering users/index > > > Completed in 11184ms (View: 8116, DB: 364) > > > > Rendering sessions/new > > > Completed in 1696ms (View: 1012, DB: 0) > > > > Rendering users/index > > > Completed in 8361ms (View: 6898, DB: 107) > > > > #users/index.html.erb > > > <div> > > > <h2>Users</h2> > > > <%= render :partial => "users/user", :collection => @users %> > > > <%= will_paginate @users %> > > > <% if @users.empty? -%> > > > <p class="infobox">Looks like we couldn't find > > > anything matching your search. Maybe you should consider broadening it? > > > </p> > > > <% end -%> > > > </div> > > > > #_user.html.erb > > > <% div_for user do %> > > > <h2><%= link_to(image_tag(user.photo.url(:small), :alt => > > > user.login, :height => 130, :width => 130, :class => "profile-photo"), > > > user) %><%= link_to(user.login, user) %></h2> > > > <p class="user-location"><%= user.age %> / <%= user.sex %> / < > > > %= user.city %>, <%= user.state %></p> > > > <p class="user-summary"><%= truncate_words(user.about_me || > > > "", 80) -%></p> > > > <% end %> > > > > The template code is here too:http://gist.github.com/90786 > > > > Any ideas? > > > > Thanks! > > > > Avishai --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---