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
-~----------~----~----~----~------~----~------~--~---

Reply via email to