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 9.1.16 still slow on Java8 without -Xcompile.invokedynamics=false #5238

Closed
ninkibah opened this issue Jul 5, 2018 · 7 comments
Closed

Comments

@ninkibah
Copy link

ninkibah commented Jul 5, 2018

Environment

  • JRuby version: jruby 9.1.16.0 (2.3.3) 2018-02-21 8f3f95a Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [linux-x86_64]
  • Operating system and platform: Linux joconnor-HP-ENVY-Notebook-13-ab0XX 4.15.0-23-generic JRUBY-5190 #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Tomcat version: 7.0.53

Expected Behavior

  • My rails 5.1 app works fine in standalone mode. I expect to get similar speed when I put the war file in a tomcat server.

Actual Behavior

  • Pages often take more than 10 seconds to appear, even on a local tomcat server.

Solution

I started tomcat with -Xcompile.invokedynamics=false and the problem disappeared. This was the fix recommended 4 years ago in #1858

As Java 8 is extremely old, and tomcat 7.0.53 is also not new, it may not be worth fixing this problem.

@ninkibah
Copy link
Author

ninkibah commented Jul 5, 2018

The cause of this is not compile.invokedynamics=false. I was not running tomcat correctly. But there is definitely a performance problem when running under tomcat. I am investigating further.

@ninkibah
Copy link
Author

ninkibah commented Jul 5, 2018

I downloaded the latest version of Wildfly (13.0.0 Final).
I copied my war file to standalone/deployments and started wildfly.

The speed problems are clearer. It appears to take upto 20 seconds to deliver the HTTP response from the server to the browser!

One example of a simple show page:
It took 10ms for 2 SQL Selects, 340ms to generate the views, but then 20 seconds before the page appears on the browser.

I believe this is the same behaviour as in tomcat. Does anyone know why a warbler generated WAR file should display such behaviour? Is puma (the default web server) getting in the way of tomcat or wildfly?

@ninkibah
Copy link
Author

ninkibah commented Jul 6, 2018

I solved my problem.
IT IS NOT A JRUBY PROBLEM.
I downloaded the latest version of tomcat, 8.5.32, threw my war file into the webapps directory, and started it. No configuration changes!
My application is as quick as when it runs in development.

I still have no idea why both tomcat 7.0.53 and wildfly 13.0.0 Final take so long to deliver the HTML output back to the browser. I should note that generation of the views often took more than a second, which seems rather long for my simple views (just a table with 50 rows and 4 columns).

I'm going to close this ticket now

@ninkibah ninkibah closed this as completed Jul 6, 2018
@enebo enebo added this to the Invalid or Duplicate milestone Jul 6, 2018
@ninkibah ninkibah reopened this Jul 10, 2018
@ninkibah
Copy link
Author

ninkibah commented Jul 10, 2018

As I have been able to reproduce this problem with a small sample rails app, I have reopened this issue.

Code and instructions for building the rails app are here: https://github.com/ninkibah/tc2

After starting tomcat If you refresh the page from 5-20 times, you will notice that at least one of the
refresh times is taking a very long time (more than 10 seconds) to come up.
I have noticed that rails itself says it has produced the view (normally in under 500ms).
My guess is that the problem occurs in the jruby/rack code.

Running as a standalone puma app shows no performance problems.

@headius
Copy link
Member

headius commented Jul 10, 2018

Awesome, thank you for the reproduction. I suspect something about deployment in a container is messing with how we generate invokedynamic calls.

@ninkibah
Copy link
Author

I appreciate how much you and Tom and the rest of the team do, so I feel obliged to make your jobs as easy as possible. However, to make my stripped down app, I failed to create a new rails app. For some reason on deployment, I kept getting errors from bundler not being able to find the rake gem. I suspect, I will have to create a ticket in jruby/warbler, as I completely failed to see any difference between my stripped down app, and a new rails app.

@headius
Copy link
Member

headius commented Jul 13, 2018

@ninkibah Ok I'm going to re-close this. If you can figure out a good way for us to reproduce it, we can help. It would also help to get your (JVM flag) -XX:+PrintGCDetails output around the time it slows down, and perhaps output from (JRuby flag) -Xjit.logging or (JVM property) jruby.jit.logging=true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants