COW-friendly Ruby 1.9?

Here’s my test script:

a = []
(1024**2*10).times do
a << Object.new
end
puts ‘allocated’
gets
GC.start
puts “GC’d”
gets
GC.start unless fork
puts “GC’d and sleeping”
sleep 10

I’m using Ruby 1.9.1 from the Ubuntu Karmic repositories on x86_64.

This seems to use about 600 megs once it’s allocated. (I’m
un-scientifically
watching ‘free -m’ to see what happens.) If I don’t do the second GC,
the
forked child doesn’t use much more. When I do GC in the child, or in the
parent after the fork, it pretty much exactly doubles – another 600
megs.

This is disappointing. After all the noise from Merb, Unicorn, Phusion,
and
“enterprise edition”, and especially considering that forking is the
only real
way to make MRI scale to multiple cores, I’d have expected some sort of
COW-
friendly GC to have been merged already. Wasn’t someone working on this
somewhere back in 1.9.0?

Or is there something wrong with my benchmark? I mean, it’s clearly
artificial,
and I haven’t tried comparing it to the various “enterprise edition”
patches.

On Sat, Nov 21, 2009 at 12:26 PM, David M. [email protected]
wrote:

This is disappointing. After all the noise from Merb, Unicorn, Phusion, and
“enterprise edition”, and especially considering that forking is the only real
way to make MRI scale to multiple cores, I’d have expected some sort of COW-
friendly GC to have been merged already. Wasn’t someone working on this
somewhere back in 1.9.0?

See [ruby-core:19799] for a bitmap-marking GC patch.

jeremy

On Saturday 21 November 2009 03:14:14 pm Jeremy K. wrote:

On Sat, Nov 21, 2009 at 12:26 PM, David M. [email protected] wrote:

This is disappointing. After all the noise from Merb, Unicorn, Phusion,
and “enterprise edition”, and especially considering that forking is the
only real way to make MRI scale to multiple cores, I’d have expected some
sort of COW- friendly GC to have been merged already. Wasn’t someone
working on this somewhere back in 1.9.0?

See [ruby-core:19799] for a bitmap-marking GC patch.

Yes, I saw that. Something about SEGV in make test – and I really don’t
see
any follow-up to that. What’s the status of getting something like this
actually in core and stable?

On Nov 21, 2009, at 13:50 , David M. wrote:

Yes, I saw that. Something about SEGV in make test – and I really don’t see
any follow-up to that. What’s the status of getting something like this
actually in core and stable?

You can help by re-asking this in ruby-core@

Hi,

In message “Re: COW-friendly Ruby 1.9?”
on Sun, 22 Nov 2009 05:26:33 +0900, David M.
[email protected] writes:

|Or is there something wrong with my benchmark? I mean, it’s clearly artificial,
|and I haven’t tried comparing it to the various “enterprise edition” patches.

The REE patch made Ruby so slow on some non-Web cases. AuthorNari
made the faster patch. But it’s still (much) slower than the original
GC for non forking programs. Besides that, the patch had the serious
bug which we could not identify for long time.

Ko1 is working on improvement on Ruby’s memory management (not GC).
We have good chance to make the GC COW friendly base on that
improvement. Stay tuned.

          matz.