I am trying to start out of range garbage collection (after the request has finished responding) in my Ruby on Rails application. I added the following to my config.ru:
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) begin require 'unicorn/oob_gc' rescue LoadError, NameError end
However, I look at the NewRelic portal, and most web transactions show that an average of at least 110-150 ms is spent on garbage collection. Unicorn :: OoobGC should have done this outside the scope of the actual request? If so, why does this manifest itself in an online transaction? How do I get the time spent collecting garbage to occur outside the context of the web request in order to respond more quickly to customer requests? The time spent by the processor will still be the same, since it should happen in the background, but better in the background than maintaining the query pipeline.
randombits
source share