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

Consider dropping -Xss from launcher #3741

Closed
headius opened this Issue Mar 17, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@headius
Member

headius commented Mar 17, 2016

Some years ago, we force the default minimum stack size for JVM threads to 2048k, because the default (on 64-bit) of 1024k was too small for some recursion-heavy tools like Bundler. We blew out that stack a lot also because our AST was a recursive interpreter. Since then, bundler has been made iterative and we now interpret a flat structure...so it may be possible for us to drop our stack size tweaking too.

Relates to #3739.

@headius headius added this to the JRuby 9.1.0.0 milestone Mar 17, 2016

@nirvdrum

This comment has been minimized.

Show comment
Hide comment
@nirvdrum

nirvdrum Mar 17, 2016

Contributor

I seem to recall this being a problem on TorqueBox for some reason as well. It's possible TorqueBox handles it by setting an option on its own. Or I could just be making all of this up.

@bbrowning Does any of this sound familiar?

Contributor

nirvdrum commented Mar 17, 2016

I seem to recall this being a problem on TorqueBox for some reason as well. It's possible TorqueBox handles it by setting an option on its own. Or I could just be making all of this up.

@bbrowning Does any of this sound familiar?

@nirvdrum

This comment has been minimized.

Show comment
Hide comment
@nirvdrum

nirvdrum Mar 17, 2016

Contributor

And now that I've commented this quickly, I realize this is in the launcher and TorqueBox has its own. Sorry for the noise.

Contributor

nirvdrum commented Mar 17, 2016

And now that I've commented this quickly, I realize this is in the launcher and TorqueBox has its own. Sorry for the noise.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Mar 18, 2016

Member

@bbrowning If there's a test case that would fail if stack is too small, it might be interesting to try it with default stack size again.

I'm less gun-ho on this one because the worst it does now is make threads twice as large in memory, to the tune of a measly 1MB per. Unless you're running some 100-way machine that's not likely to matter much. It would just be nice to trim the fat in our launchers.

Member

headius commented Mar 18, 2016

@bbrowning If there's a test case that would fail if stack is too small, it might be interesting to try it with default stack size again.

I'm less gun-ho on this one because the worst it does now is make threads twice as large in memory, to the tune of a measly 1MB per. Unless you're running some 100-way machine that's not likely to matter much. It would just be nice to trim the fat in our launchers.

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Mar 18, 2016

Member

How much does our stack depth change once we turn this off? I am sure that depends on inlining and stuff like that but we did have some simple how deep script committed somewhere.

Member

enebo commented Mar 18, 2016

How much does our stack depth change once we turn this off? I am sure that depends on inlining and stuff like that but we did have some simple how deep script committed somewhere.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Apr 19, 2016

Member

I ran some numbers.

All on Java 8u60, with the following code:

def foo(a)
  if a > 0
    foo(a - 1)
  else
    puts :success
  end
end
foo(N)

Here's interpreter. In 9.1 it is only the simple interpreter.

JRuby 1.7.24 JRuby 9.1
Default flags 650 700
with -Xss2048k 1350 1250

And with normal jit settings:

JRuby 1.7.24 JRuby 9.1
Default flags 1450 800
with -Xss2048k 3400 1700

This difference in 9.1 is a bit of a worry. The interpreter seems about the same (I'd hope it would be better, even though this is a simple AST). The compiler is significantly worse. A general reason for this may be additional frames around our IR interpreted and compiled paths that could be collapsed. The compiler may suffer from invokedynamic "lambda forms" bloating the stack for early calls.

In any case, I don't think we're going to be able to drop the flag any time soon. I will open a separate bug for the poor stack depths in 9.1.

Member

headius commented Apr 19, 2016

I ran some numbers.

All on Java 8u60, with the following code:

def foo(a)
  if a > 0
    foo(a - 1)
  else
    puts :success
  end
end
foo(N)

Here's interpreter. In 9.1 it is only the simple interpreter.

JRuby 1.7.24 JRuby 9.1
Default flags 650 700
with -Xss2048k 1350 1250

And with normal jit settings:

JRuby 1.7.24 JRuby 9.1
Default flags 1450 800
with -Xss2048k 3400 1700

This difference in 9.1 is a bit of a worry. The interpreter seems about the same (I'd hope it would be better, even though this is a simple AST). The compiler is significantly worse. A general reason for this may be additional frames around our IR interpreted and compiled paths that could be collapsed. The compiler may suffer from invokedynamic "lambda forms" bloating the stack for early calls.

In any case, I don't think we're going to be able to drop the flag any time soon. I will open a separate bug for the poor stack depths in 9.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment