LoginSignup
25
25

More than 5 years have passed since last update.

Ruby2.1+でのunicornのGCチューニング

Posted at

unicornのGCでお世話になっているunicorn/oob_gcだが、https://github.com/defunkt/unicorn/blob/master/lib/unicorn/oob_gc.rb を見てみると

Strongly consider https://github.com/tmm1/gctools if using Ruby 2.1+ It is built on new APIs in Ruby 2.1, so it is more intelligent than this historical implementation.

Ruby2.1+の場合は https://github.com/tmm1/gctools を使ってね、とのこと。

作者の記事: http://tmm1.net/ruby21-oobgc/
日本語訳: http://www.sawanoboly.net/contribution/2014/3/13/ruby-21-out-of-band-gc

READMEによるとruby2.1で提供されているapiとイベントを使ってGCの挙動を変更するらしい。したがってunicorn/oob_gcとセットでやっていたGC.disableはいらなくなる。

インストールは

gem install gctools

bundlerを使う場合はGemfileに

gem 'gctools'

のあとbundle install

unicornで使う場合はconfig.ruに以下を追記。

require 'gctools/oobgc'
if defined?(Unicorn::HttpRequest)
  use GC::OOB::UnicornMiddleware
end
25
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
25