We are attempting to migrate our Rails 3.2 app to Java 8. It runs fine with JRuby 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.
jruby enables invoke dynamic when it detects java 8 and it is dead slow with rails, just disable it.
-Xcompile.invokedynamics=false
Hannes, thanks for the tip. My tests now run a little bit quicker than with Java 7.
But, I thought invoke dynamic was going to make Ruby super fast, so how come it doesn't work with Rails code? Too much meta-programming?
I thought it should be superfast too but it is not, see my benchmark in this issue #1569 (I got pretty graphs). I do not really know why it is so painfully slow with rails.. it will get fast eventually but it takes about 25K requests before it is done optimizing...
As St. Augustine, who programmed in the 4th Century, used to say: "Lord make me optimized, but not just yet"
An addendum to this issue is that on Java 8 we have indy disabled by default. It can be turned on when it works for you, but for now we have had too many complaints about startup time for Rails applications.
is this still true for recent Java 8 builds? or Rails 4.2?
@jcode nope, definitely not the case anymore. if you're seeing any perf. regression on Java 8 open an issue
Most helpful comment
@jcode nope, definitely not the case anymore. if you're seeing any perf. regression on Java 8 open an issue