My app on Heroku was previously on cedar with Java 7. I just updated to
cedar-14 and Java 8.
One thing I was wary of was big performance problems because of invoke
dynamic being set to true when JRuby detected Java 8, as described in
these
issues:
opened 02:34PM - 25 Jul 14 UTC
closed 04:49PM - 25 Jul 14 UTC
We are attempting to migrate our Rails 3.2 app to Java 8. It runs fine with JRub… y 1.7.9 under Java 6 and Java 7 (Java 7 is a bit faster). However, under Java 8, my tests took 42 minutes elapsed time instead of about 7 minutes. Nobody else seems to have seen this. My colleague has the same issue, and it also happens on a Centos machine we use for testing.
I don't believe it is a problem of memory, as we are giving JAVA 500MB more memory to play with than Java 7.
When we look at execution times of request handling, ActiveRecord (using jdbc-postgres) seems fast but rendering templates takes a very long time. So I suspect String building may be the cause of it.
Versions:
JRuby 1.7.9 or 1.7.13
Java 1.8.0_11 64-Bit Server build 25.11-b03.
Ubuntu 12.04 (Don't know the version of Centos on test machine)
JAVA_OPTS="-Xms512m -Xmx2096m -Djava.net.preferIPv4Stack=true"
Any tips on hunting down the performance problem would be appreciated.
opened 02:33PM - 20 Mar 14 UTC
closed 12:12AM - 29 Nov 17 UTC
performance
invokedynamic
JRuby 1.7.x
regression
The app is a pretty straight Rails app with scaffolding and accesses a PostgreSQ… L 9.3 database locally using ActiveRecord. Running on 64 bit Linux, Centos 6.5 with Oracle JDK 8 installed by RPM.
We start with these options:
```
jruby --2.0 --server -J-Xmx2G
```
Adding `-Xcompile.invokedynamic=false` makes performance about the same as Java 7, maybe a bit better.
The app uses the following Gemfile.lock:
```
GIT
remote: https://github.com/DatekWireless/rails3-jquery-autocomplete.git
revision: 5e20cd01ddb135c877b4edf482552c989196732d
specs:
rails3-jquery-autocomplete (1.0.12)
rails (>= 3.0)
GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
actionmailer (3.2.16)
actionpack (= 3.2.16)
mail (~> 2.5.4)
actionpack (3.2.16)
activemodel (= 3.2.16)
activesupport (= 3.2.16)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.16)
activesupport (= 3.2.16)
builder (~> 3.0.0)
activerecord (3.2.16)
activemodel (= 3.2.16)
activesupport (= 3.2.16)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-jdbc-adapter (1.3.6)
activerecord (>= 2.2)
activerecord-jdbcpostgresql-adapter (1.3.6)
activerecord-jdbc-adapter (~> 1.3.6)
jdbc-postgres (>= 9.1)
activeresource (3.2.16)
activemodel (= 3.2.16)
activesupport (= 3.2.16)
activesupport (3.2.16)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
ansi (1.4.3)
arel (3.0.3)
bcrypt-ruby (3.0.1-java)
bootstrap-datepicker-rails (1.3.0.1)
railties (>= 3.0)
builder (3.0.4)
capybara (2.2.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.5.1)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
database_cleaner (1.2.0)
docile (1.1.3)
erubis (2.7.0)
exception_notification (4.0.1)
actionmailer (>= 3.0.4)
activesupport (>= 3.0.4)
execjs (2.0.2)
ffi (1.9.3-java)
hashie (2.0.5)
hike (1.2.3)
i18n (0.6.9)
jdbc-postgres (9.3.1101)
journey (1.0.4)
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1-java)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile (0.5.2)
minitest (4.7.5)
minitest-reporters (0.14.24)
ansi
builder
minitest (>= 2.12, < 5.0)
powerbar
monetize (0.1.4)
money (6.0.1)
i18n (~> 0.6.4)
monetize (~> 0.1.3)
money-rails (0.9.0)
activesupport (>= 3.0)
money (~> 6.0.0)
railties (>= 3.0)
multi_json (1.9.2)
nokogiri (1.6.1-java)
mini_portile (~> 0.5.0)
paper_trail (3.0.1)
activerecord (>= 3.0, < 5.0)
activesupport (>= 3.0, < 5.0)
polyglot (0.3.4)
powerbar (1.0.11)
ansi (~> 1.4.0)
hashie (>= 1.1.0)
puma (2.8.1-java)
rack (>= 1.1, < 2.0)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.16)
actionmailer (= 3.2.16)
actionpack (= 3.2.16)
activerecord (= 3.2.16)
activeresource (= 3.2.16)
activesupport (= 3.2.16)
bundler (~> 1.0)
railties (= 3.2.16)
rails-assets-bootstrap (3.1.1)
rails-assets-jquery (>= 1.9.0)
rails-assets-jquery (1.11.0)
rails-assets-jquery-ui (1.10.4)
rails-assets-jquery (>= 1.6)
railties (3.2.16)
actionpack (= 3.2.16)
activesupport (= 3.2.16)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.1.1)
rdoc (3.12.2)
json (~> 1.4)
rubyzip (1.1.2)
rufus-scheduler (3.0.7)
tzinfo
sass (3.3.3)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
schema_plus (1.4.1)
rails (>= 3.2)
valuable
selenium-webdriver (2.40.0)
childprocess (>= 0.5.0)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
simple_workflow (1.0.3)
rails (>= 3.0.0)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
therubyrhino (2.0.3)
therubyrhino_jar (>= 1.7.3)
therubyrhino_jar (1.7.4)
thor (0.18.1)
tilt (1.4.1)
timecop (0.7.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbo-sprockets-rails3 (0.3.11)
railties (> 3.2.8, < 4.0.0)
sprockets (>= 2.2.0)
tzinfo (0.3.39)
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
unicode_utils (1.4.0)
valuable (0.9.8)
websocket (1.0.7)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
java
DEPENDENCIES
activerecord-jdbcpostgresql-adapter
bcrypt-ruby (~> 3.0.1)
bootstrap-datepicker-rails (~> 1.3.0.1)
capybara
chunky_png
coffee-rails (~> 3.2.1)
database_cleaner
exception_notification
jquery-rails
minitest-reporters (< 1.0.0)
money-rails
nokogiri
paper_trail
puma
rails (= 3.2.16)
rails-assets-bootstrap
rails-assets-jquery (< 2.0.0)
rails-assets-jquery-ui
rails3-jquery-autocomplete!
rufus-scheduler
sass-rails (~> 3.2.3)
schema_plus
selenium-webdriver
simple_workflow
simplecov
therubyrhino
timecop
turbo-sprockets-rails3
uglifier (>= 1.0.3)
unicode_utils
```
But I haven’t seen any problem so far. Maybe for some reason invoke
dynamic
is actually still off for me? Is there a way I check this at runtime in
irb?
John
The Ruby buildpack automatically sets the JRUBY_OPTS environment
variable with -Xcompile.invokedynamic=false. So invoke dynamic will be
off by default. You can confirm this by running heroku config
.
On Wed, Mar 18, 2015 at 3:14 AM, John Joseph B.
On Wed, Mar 18, 2015 at 3:30 AM, Joe K. [email protected] wrote:
The Ruby buildpack automatically sets the JRUBY_OPTS environment variable
with -Xcompile.invokedynamic=false. So invoke dynamic will be off by
default. You can confirm this by running heroku config
.
Ahh okay, that explains it. Thanks!
(Since the buildpack sets it, it can’t be seem from heroku config
, but
I
see it in my dyno environment:)
~ *$ *env | grep JRUBY
JRUBY_OPTS=-Xcompile.invokedynamic=false
~ *$ *env | grep JAVA
JAVA_OPTS=-Xms750m -Xmx750m -Xss512k -XX:+UseCompressedOops
JAVA_TOOL_OPTIONS=-Xmx768m -Djava.rmi.server.useCodebaseOnly=true