Bug 791011 - slow performance with enable-pthread
Summary: slow performance with enable-pthread
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ruby
Version: 6.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Vít Ondruch
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 782183
TreeView+ depends on / blocked
 
Reported: 2012-02-15 22:41 UTC by Dave Sullivan
Modified: 2018-12-01 18:43 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-07 22:35:23 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Dave Sullivan 2012-02-15 22:41:35 UTC
Description of problem:

It is well known enable-pthread option is causing slowness in Ruby 1.8.7. In Ruby enterprise edition, it uses disable-pthread, and in ruby version rolled out by puppet for puppet enterprise 2.0 for RHEL6, it also uses disable-pthread. In Ubuntu/Oneiric 11.10, this issue is resolved, it uses "ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]". 

In RHEL6U2 (ruby-1.8.7.352-3.el6.x86_64) and Fedora 16 (ruby-1.8.7.352-3.el6.x86_64), the enable-pthread is still in place, causing slowness. 

Upstream bug:
http://bugs.ruby-lang.org/issues/2553

Ubuntu bug:
https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/307462


Version-Release number of selected component (if applicable):


How reproducible:

See upstream bug to patch and set to disable-pthread

time ./ruby -e '1_000_000.times { x = 2 ** 256 }'


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Dave Sullivan 2012-02-15 23:47:08 UTC
Customers deployments will depend on puppet/ruby any performance gain would be beneficial right now customer is having to maintain their own ruby install.

Comment 2 RHEL Program Management 2012-09-07 05:16:00 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 4 Josef Stribny 2013-06-05 13:09:34 UTC
I tried to do some tests, and I haven't found any issues regarding binary incompatibility with the provided patch[1, 2] using ABI compliance checker tool[3] on x86-64, i386, ppc and ppc64 regarding the Ruby *.so lib. I can confirm the performance boost around 30% with the simple test mentioned in upstream bug.

Regarding the reopening the issue in upstream because of the binary incompatibility[4] it's said that this affected rabbit and mikutter installed with pkgsrc on NetBSD 5.1 (i386) which needed to be rebuilt probably because of the patched Ruby's config.h missed these 3 lines:

#define HAVE_UCONTEXT_H 1
#define HAVE_GETCONTEXT 1
#define HAVE_SETCONTEXT 1

I confirmed that with Takahiro Kambe who mentioned that in Japanese.

In our case (RHEL/i386) it obviously miss these two:
#define HAVE_GETCONTEXT 1
#define HAVE_SETCONTEXT 1

(#define HAVE_UCONTEXT_H 1 is there)

So to say Ruby will use _longjmp()/_setjmp() instead of getcontext()/setcontext() which is actually what the patch does in the first place[2]. How big this can be an issue for us I am not sure. If somebody knows how this could affect something in our distribution, please say so.


[1] http://timetobleed.com/fix-a-bug-in-rubys-configurein-and-get-a-30-performance-boost/
[2] https://github.com/ice799/matzruby/commit/0b9b69f9653782a33aee2b8937d405eae245b60c
[3] http://ispras.linuxbase.org/index.php/ABI_compliance_checker
[4] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/43152

Comment 5 Dave Sullivan 2013-06-05 18:14:37 UTC
Josef,

Per Vit email conversation...

"Disabling pthreads resolves the slowness issue but introduces binary incompatibility.   Because of RHEL's KABI/ABI restrictions this is not applicable to RHEL. If you disable pthreads, you cannot build tcl/tk bindings anymore. So at present time there is no available solution"

Comment 6 RHEL Program Management 2013-10-14 00:47:51 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.


Note You need to log in before you can comment on or make changes to this bug.