On 6 Apr 2009, at 16:14, Avishai 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...

I'd turn up your log level. If for example each user partial was  
loading its photo from the database 1 by 1 then you'd see a zillion  
sql queries in your log.

Fred
>
>
> #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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to