Peformance up - using OobGC & GC.disable

secondlife hotchpotch at
Tue Oct 4 03:10:38 EDT 2011

I'm working at Cookpad Inc.


Cookpad is very famous cooking recipe service in Japan,
and largest rails application in Japan.

I applied GC.disable after fork, and a few changed Unicorn::OobGC.

# unicorn.conf.rb
 after_fork do |server, worker|
  GC.disable if RAILS_ENV == 'production'

# OobGC code
 def process_client(client)
  super(client) # Unicorn::HttpServer#process_client
  if OOBGC_PATH =~ OOBGC_ENV[PATH_INFO] && ((@@nr -= 1) <= 0)
    disabled = GC.enable
    GC.disable if disabled

after applied,
application response time 130% fast!
and CPU usage to half!

- (response time)
- (CPU usage)

This is OobGC patch, apply please.
- (patch)

Also, my rails application have memory leaks ;(
I wrote process killing code because GC.disable create more memory leak.

Yuichi Tateno

More information about the mongrel-unicorn mailing list