[ruby-core:67051] [ruby-trunk - Bug #10631] Rails 4.2 much slower on 2.2.0-rc1 vs. 2.1.5

From: felix.buenemann@...
Date: 2014-12-23 00:53:01 UTC
List: ruby-core #67051
Issue #10631 has been updated by Felix B端nemann.


I tried the following patch against ruby-trunk r48405 to make sure this is the Dir[] performance regression:

~~~
--- a/dir.c
+++ b/dir.c
@@ -1241,7 +1241,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
        else {
            const char *m = find_dirsep(p, e, flags, enc);
            const enum glob_pattern_type magic = has_magic(p, m, flags, enc);
-           const enum glob_pattern_type non_magic = (HAVE_HFS || FNM_SYSCASE) ? PLAIN : ALPHA;
+           const enum glob_pattern_type non_magic = ALPHA;
            char *buf;

            if (!(FNM_SYSCASE || magic > non_magic) && !recursive && *m) {
~~~

After that performance problems on OS X are gone.

Please mark this as a duplicate of #10015 and close it.

----------------------------------------
Bug #10631: Rails 4.2 much slower on 2.2.0-rc1 vs. 2.1.5
https://bugs.ruby-lang.org/issues/10631#change-50570

* Author: Felix B端nemann
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.2.0rc1 (2014-12-18 trunk 48887) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
I'm seeing huge slowdowns when running Rails 4.2.0 on Ruby 2.2.0-rc1 (or -preview1) compared to Ruby 2.1.5.

On a production app I'm seeing ajax requests taking 4 seconds instead of 400 milliseconds.

I was also able to reproduce this using a very simple rails app:
https://github.com/felixbuenemann/rails-ruby22-regression

It has only 3 pages that link to each other and wiselinks gem for PJAX support.
The reason I included wiselinks is because it shows even larger differences in request time. 
On the demo app a wiselinks requests takes under 20ms for 2.1.5 vs. 480ms on 2.2.0-rc1.

Similar differences can be seen on normal requests as measured by wrk:

~~~
chruby 2.1.5

ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]

wrk -c1 -t1 -d30 --latency http://localhost:3000/pages/a
Running 30s test @ http://localhost:3000/pages/a
  1 threads and 1 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    56.87ms    6.35ms  88.48ms   82.20%
    Req/Sec    17.15      3.00    20.00     71.20%
  Latency Distribution
     50%   54.86ms
     75%   60.03ms
     90%   65.94ms
     99%   78.46ms
  529 requests in 30.01s, 1.33MB read
Requests/sec:     17.63
Transfer/sec:     45.50KB

chruby 2.2.0-rc1

ruby -v
ruby 2.2.0rc1 (2014-12-18 trunk 48887) [x86_64-darwin14]

wrk -c1 -t1 -d30 --latency http://localhost:3000/pages/a
Running 30s test @ http://localhost:3000/pages/a
  1 threads and 1 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   255.41ms   13.24ms 301.49ms   75.51%
    Req/Sec     3.51      0.74     5.00     85.71%
  Latency Distribution
     50%  251.72ms
     75%  262.70ms
     90%  274.60ms
     99%  301.49ms
  117 requests in 30.04s, 301.98KB read
Requests/sec:      3.89
Transfer/sec:     10.05KB
~~~

As can be seen average request time jumped from 57ms to 255ms.
I also noticed that the difference gets larger the more code/gems the app loads.

All tests where done in development mode.
Using production mode both ruby versions are similarly fast, so this might have to do with rails dynamic code reloading in development mode.

Both rubies were installed without special options using ruby-install and no tweaking of GC/HEAP was done.



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next