Ruby 2.2: first look

(Jens Maier) #1

So in a bout of update frenzy I’ve accidently upgraded my system Ruby to 2.2 and decided to use this as an excuse to test Discourse with ruby 2.2.0p0 r49005.

Right off the bat, I have to make two changes to even get Discourse running:

  • change Gemfile.lock to use version 1.8.2 of the json gem. Version 1.8.1 was moved into Ruby’s stdlib, the native extension for the 1.8.1 gem won’t compile against the Ruby 2.2 C API. (Actually, this change made it into master only hours ago. :+1:)

  • set UNICORN_ENABLE_OOBGC=0 in the environment to disable out-of-band gargabe collection in unicorn in production. According to this, Ruby 2.2’s incremental GC makes oob GC largely unnecessary.

Apart from this, things seem to be stable at first glance, but I’m definitely going to have a close look at my error logs and performance counters over the next few days.

All in the name of not admitting a mistake and just downgrading back to Ruby 2.1… :grin:

(Sam Saffron) #2

FYI no need to muck with UNICORN_ENABLE_OOBGC I fixed it.

(Jeff Atwood) #3

Yes we are running on Ruby 2.2 on meta and have been for a few days now.

(Jeff Atwood) #4

Any other observations about Ruby 2.2? Didn’t you say CPU usage was lower? What other bullet points are here in Ruby 2.2’s favor? Simpler config (no more magic params)?

(Sam Saffron) #5

Advantages to using 2.2

  1. Massively reduced CPU usage (almost halved under some workloads)
  2. Similar performance for median
  3. Improved performance for 90th percentile and up.
  4. Default GC settings are good
  5. Similar memory usage to 2.0, massively reduced from 2.1
  6. No need for OOBGC (out of band gc)

Ansible-discourse: Install Discourse with Ansible (without Docker)

I’m curious how long it will be until this makes it’s way into the standard docker installs? Halved CPU utilization would be greatly appreciated by many.

(Sam Saffron) #7

Its been running on meta for a few weeks now, maybe in a week or so, depending on how busy I am.

(Pirat) #8

and vulnerability checks discourse somebody?

(Dave Kokorro) #9

@sam are there any particular changes needed or gotchas to be aware of when switching to Ruby 2.2 (when running tests-passed branch)?

(Sam Saffron) #10

nope 2.2 works fine no special handling needed

Ansible-discourse: Install Discourse with Ansible (without Docker)
(ljpp) #11

Why the Docker images are still using Ruby 2.0? I could sure use the CPU benefits.

(Sam Saffron) #12

You can try it out, we just have not found it to be a compelling upgrade quite yet.

you have to use this image and run use_22 prior to doing bundle install.

This is done by adding

base_image: discourse/discourse_fast_switch:1.0.16

and then adding

   - exec: use_22

(Jeff Atwood) #13

The potential support issues of being on a non standard config far outweigh any minor benefits this would confer.