The problem
All of the sudden my rails app started to take about 60 seconds serving the initial request and sequential requests if something was changed in assets.
What did I try
There is a lot of answers on SO regarding "rails, render, slow", but none of them helped, because problem seems to be in different area.
Then I tried to rollback gem versions to older point, where this problem didn't exist. No luck. I didn't update anything in the system(rvm, homebrew), so there was nothing to rollback to.
Then I installed ruby-prof
profiler and saw that rails spent all the time executing V8::C::String#Utf8Value
, but I can't get anything from it.
Diagnostic info
I use OSX Mavericks.
server log:
Started GET "/" for 127.0.0.1 at 2014-04-08 05:30:49 +0200 Processing by HomeController#index as HTML User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1 Rendered home/index.html.erb within layouts/application (64211.8ms) Completed 200 OK in 64248ms (Views: 64218.0ms | ActiveRecord: 2.1ms)
profiler log(scroll horizontally):
%total %self total self wait child calls Name
--------------------------------------------------------------------------------
61.042 0.000 0.000 61.042 2/2 V8::Conversion::Fundamental#to_ruby
87.50% 0.00% 61.042 0.000 0.000 61.042 2 V8::Conversion::NativeString#to_ruby
61.042 61.042 0.000 0.000 2/2 V8::C::String#Utf8Value
--------------------------------------------------------------------------------
61.042 61.042 0.000 0.000 2/2 V8::Conversion::NativeString#to_ruby
87.50% 87.50% 61.042 61.042 0.000 0.000 2 V8::C::String#Utf8Value
--------------------------------------------------------------------------------
8.528 0.000 0.000 8.528 4/4 Proc#call
12.22% 0.00% 8.528 0.000 0.000 8.528 4 V8::Error::Try#try
8.528 0.000 0.000 8.528 4/4 <Module::V8::C>#TryCatch
--------------------------------------------------------------------------------