gctools icon indicating copy to clipboard operation
gctools copied to clipboard

Ruby 2.2 Support?

Open samnang opened this issue 10 years ago • 9 comments

After I upgraded my Rails(4.1.8) to Ruby 2.2.0. I notice some error messages in my logs:

app web.1     - - E, [2015-01-02T04:19:12.265987 #12] ERROR -- : listen loop error: unknown key: old_object (ArgumentError)
app web.1     - - E, [2015-01-02T04:19:12.266103 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/gctools-0.2.3/lib/gctools/oobgc/unicorn_middleware.rb:14:in `run'
app web.1     - - E, [2015-01-02T04:19:12.266146 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/gctools-0.2.3/lib/gctools/oobgc/unicorn_middleware.rb:14:in `process_client'
app web.1     - - E, [2015-01-02T04:19:12.266177 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-worker-killer-0.4.2/lib/unicorn/worker_killer.rb:51:in `process_client'
app web.1     - - E, [2015-01-02T04:19:12.266207 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-worker-killer-0.4.2/lib/unicorn/worker_killer.rb:124:in `process_client'
app web.1     - - E, [2015-01-02T04:19:12.266237 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'
app web.1     - - E, [2015-01-02T04:19:12.266267 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
app web.1     - - E, [2015-01-02T04:19:12.266296 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start'
app web.1     - - E, [2015-01-02T04:19:12.266324 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
app web.1     - - E, [2015-01-02T04:19:12.266354 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/bin/unicorn:23:in `load'
app web.1     - - E, [2015-01-02T04:19:12.266381 #12] ERROR -- : /app/vendor/bundle/ruby/2.2.0/bin/unicorn:23:in `<main>'

I was wondering do we still suppose to use it on Ruby 2.2? Or it should only be used on Ruby 2.1?

samnang avatar Jan 03 '15 04:01 samnang

oobgc is unnecessary in Ruby 2.2, since it includes an incremental GC (RIncGC) and will not pause the world for a long time.

tmm1 avatar Jan 03 '15 04:01 tmm1

Thank @tmm1 .

samnang avatar Jan 03 '15 04:01 samnang

I'm going to leave this open (so others can find it) until I get a chance to update the README.

tmm1 avatar Jan 03 '15 04:01 tmm1

Any chance you might merge hale's pull request? I, too, inferred that gctools was still relevant to Ruby >= 2.2, since the repo had recent commits but had no mention of being obsolete. Thanks!

noach-cellogicmobile avatar Jan 20 '16 15:01 noach-cellogicmobile

@tmm1 I believe v0.2.4 supports ruby >= 2.2 quite well now.

jdowning avatar Jun 07 '16 21:06 jdowning

So if it's not needed in 2.2 what does it do when we run it in Ruby 2.2?

thedrow avatar Jun 19 '16 11:06 thedrow

@thedrow I believe it "just works". I think this commit adds support for the ruby 2.2 symbol name.

I'm using it with Rails 4 + Ruby 2.3 just fine.

jdowning avatar Jun 20 '16 13:06 jdowning

I'm confused. It doesn't fail but it does nothing useful on 2.2? Or does it still provide a benefit when running under MRI Ruby 2.2?

thedrow avatar Jun 21 '16 05:06 thedrow

The answer to "is there a benefit" is... wait for it... workload dependent. Tada! What a shocker!

RIncGC behaves differently from a web-request-based "Out-of-band GC", so you can't replace one with the other and expect the exact same performance behaviour.

If your app spawns a lot of temp vars and triggers multiple GC runs during every request, and you'd like to have a clean slate before every new request (and avoid triggering as many GC during requests--remember, RIncGC still slows your app down, they just won't block for the entire duration of a GC run), then OOBGC can still be helpful. If, on the other hand, you've kept your app pretty light and there isn't a lot of garbage created per request, and a GC is only triggered once every few requests, then OOBGC will actually hurt you (very slightly) than give any benefits.

However, these are broad stroke assumptions! You MUST profile your specific app!

Where assumption and reality diverge is where you'll have performance issues.

peteygao avatar Jan 25 '17 22:01 peteygao