Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

While researching Unicorn configuration options I came across this snippet..

GC.respond_to?(:copy_on_write_friendly=) and
  GC.copy_on_write_friendly = true

If I undertand correctly, it optimizes how Unicorn handles memory allocation and resource sharing between workers?

I use Unicorn to power my Sinatra application on server with Ruby 1.9.3. Are there any downsides to including the copy_on_write_friendly setting in my unicorn config?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

That's not a configuration option, it's a Ruby code snippet that tells it to set copy_on_write_friendly if the GC object has that method. For example, in ruby mainline 1.9.2p290:

1.9.2p290 :003 > GC.copy_on_write_friendly
NoMethodError: undefined method `copy_on_write_friendly' for GC:Module
    from (irb):3
    from /Users/kyle/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'

The only Ruby interpreter that supports that option to my knowledge is Ruby Enterprise Edition. There's a bit about it here: http://www.rubyenterpriseedition.com/faq.html

share|improve this answer
    
Got it, thanks. –  Miko Jan 28 '12 at 23:08
    
Ruby 2.0 also has a copy-on-write friendly GC –  NARKOZ Oct 20 '12 at 1:29
2  
@NARKOZ But to be clear, Ruby 2.0’s implementation doesn’t include the method in question (and doesn’t need anything to enable COW). –  Andrew Marshall Feb 26 '13 at 1:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.