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

Question about upgrading from 1.6.x to 1.7.x #1130

Closed
seanguo opened this issue Oct 15, 2013 · 6 comments
Closed

Question about upgrading from 1.6.x to 1.7.x #1130

seanguo opened this issue Oct 15, 2013 · 6 comments
Milestone

Comments

@seanguo
Copy link

seanguo commented Oct 15, 2013

Not sure if this is the right place to ask questions. We recently updated from JRuby 1.6.2 to 1.7.4, but got a big memory usage incrementation.
We use the embedded JRruby engine and the JSR223 API. We use eval to evaluate the script and pass some global variables to the script using ScriptContext.

Has any default behavior been changed for the JRruby 1.7.x?

@sluukkonen
Copy link
Contributor

Are you using jdk7u40? JRuby 1.7.4 enables InvokeDynamic by default if you're using jdk7u40 (or newer), which came with a new InvokeDynamic implementation that can require a lot more memory (e.g. 2-3 times more loaded classes). JRuby 1.7.5 disables InvokeDynamic by default on Java 7, partly because of this.

Anyway, if this is true, try upgrading to 1.7.5 or disabling InvokeDynamic manually by setting the property "jruby.compile.invokedynamic" to "false".

@seanguo
Copy link
Author

seanguo commented Oct 15, 2013

Thanks for your quick responding. We are using jdk "1.7.0_25", and also tried disable InvokeDynamic and upgrade to 1.7.5. But seems not get much improvement. Almost 50% more memory used.

@seanguo
Copy link
Author

seanguo commented Oct 15, 2013

And also more CPU is consumed after the upgrade.

@headius
Copy link
Member

headius commented Oct 21, 2013

1.7.0_25 should not enable invokedynamic in any case, so there's some other issue.

I would not expect JRuby 1.7 to use significantly more memory or CPU than 1.6. And it should actually run faster and more efficiently than 1.6. I think we need more information about your app and your usage of ScriptContext.

@seanguo
Copy link
Author

seanguo commented Dec 4, 2013

simply put, the usage is like following:

ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine engineByName = sem.getEngineByName("jruby");
SimpleScriptContext context = new SimpleScriptContext();
//set several shared instance to the context
context.setAttribute("appInstance", this, ScriptContext.ENGINE_SCOPE);
//in the script we will invoke methods on the instance passed in by script context
CompiledScript compile = ((Compilable) engineByName).compile(script);
compile.eval(context);

And in our real application, the script is gotten via HTTP.

@kares
Copy link
Member

kares commented Apr 8, 2016

closing as this is no longer relevant :)

@kares kares closed this as completed Apr 8, 2016
@kares kares added this to the Non-Release milestone Apr 8, 2016
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

4 participants