Sunday, 15 February 2015

Random rails partials 100 times slower than expected -



Random rails partials 100 times slower than expected -

i have big response view broken downwards partials who's construction so, * indicates partial beingness loaded more once:

show -responses --response* ---comments ----comment* ---comment_form -stats

my problem depending on size of page, of these partials take 10-20ms render couple of these partials taking 800-1000ms render. there doesn't seem pattern in ones is, ofter there same if refresh , not.

firstly use

<%= render partial: 'partial', collection: @collection, as: c %>

rather

<% @collection.each |c| %> <%= render partial: 'partial', locals: { c: c } %> <% end %>

this obvious, dont know why wasn't doing it. provided improvements not huge amount.

if running 1.9.3 upping these environment variables made huge difference, knocking 20% off request:

ruby_heap_min_slots=600000 # 60(!) times larger default ruby_gc_malloc_limit=59000000 # 7 times larger default ruby_heap_free_min=100000 # 24 times larger default

via: http://www.web-l.nl/posts/15-tuning-ruby-s-garbage-collector-with-rvm-and-passenger

ruby-on-rails ruby-on-rails-3 templates rendering

No comments:

Post a Comment