Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby with Java 8 4 to 10 times slower than Java 7 #1858

Closed
ninkibah opened this Issue Jul 25, 2014 · 7 comments

Comments

Projects
None yet
5 participants
@ninkibah
Copy link

ninkibah commented Jul 25, 2014

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.

@kwando

This comment has been minimized.

Copy link

kwando commented Jul 25, 2014

jruby enables invoke dynamic when it detects java 8 and it is dead slow with rails, just disable it.

-Xcompile.invokedynamics=false

@ninkibah

This comment has been minimized.

Copy link
Author

ninkibah commented Jul 25, 2014

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?

@ninkibah ninkibah closed this Jul 25, 2014

@kwando

This comment has been minimized.

Copy link

kwando commented Jul 25, 2014

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...

@ninkibah

This comment has been minimized.

Copy link
Author

ninkibah commented Jul 25, 2014

As St. Augustine, who programmed in the 4th Century, used to say: "Lord make me optimized, but not just yet"

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Aug 27, 2014

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.

@enebo enebo modified the milestones: JRuby 1.7.14, JRuby 1.7.15 Aug 27, 2014

hlb pushed a commit to KKBOX/FireApp that referenced this issue Sep 3, 2014

hlb pushed a commit to KKBOX/CompassApp that referenced this issue Sep 4, 2014

@hlb hlb referenced this issue Sep 6, 2014

Open

How do I upgrade? #229

@jcode

This comment has been minimized.

Copy link

jcode commented Mar 12, 2016

is this still true for recent Java 8 builds? or Rails 4.2?

@kares

This comment has been minimized.

Copy link
Member

kares commented Mar 13, 2016

@jcode nope, definitely not the case anymore. if you're seeing any perf. regression on Java 8 open an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.