Bug #10631
closedRails 4.2 much slower on 2.2.0-rc1 vs. 2.1.5
Description
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.