Run code on rails after response is sent to browser

Using Rails 3.0.7, REE 1.8.7.

I want to run the code (in particular, Garbage Collection) in Rails after the response has been sent to the browser.

Is there a way to plan something in Rails / Rack / so that I can call GC.start right after sending the response to the browser from the controller?

* Note. This is not a situation where I want to use delayed_job or resque. I already know these tools, and they are not suitable for this use case. *

+5
source share
2 answers

GC . , GC ( NewRelic) 40%. .:)

.

+1

Merb, Rails . , , , , , GC. , , .

Thread.new do 
  GC.start
end

, , , , JRuby, .

0

All Articles