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

Reduce counts when class of method is not in SCC #18356

Merged
merged 1 commit into from Oct 30, 2023

Conversation

mpirvu
Copy link
Contributor

@mpirvu mpirvu commented Oct 27, 2023

By default, OpenJ9 uses an "implicit" shared class cache (SCC) that is used to cache "bootstrap" classes and methods. Currently, methods whose class is not present in the SCC receive a high initial invocation count (3000/3000 for loopless/loopy method) in order to improve steady state throughput. However, this could affect start-up time of applications because methods are interpreted for too long before being JIT compiled.
The presence of -Xshareclasses on the command line is a sign that the user cares about start-up time and OpenJ9 automatically lowers the invocations counts to 1000/250. However, with the implicit SCC (no -Xshareclasses command line option), application classes are not cached and methods belonging to those classes will receive a large initial invocation count (3000/3000). Since application classes are likely important, we would like to use lower counts even when the implict SCC is used.

This commit lowers the initial invocation counts for methods whose class is not in SCC under the following conditions:

  • SCC is used. Rationale: -Xshareclasses:none may be a sign that user does not care about start-up that much.
  • -Xtune:throughput is not used. Rationale: this option is a clear signal that the user cares more about throughput than startup.
  • The user has not provided a specific count on the command line.
  • The JVM is in start-up mode. Rationale: this feature only seeks to improve start-up time.
  • The JVM runs on 4 or more vCPUs. Rationale: lower counts will generate more compilations which will compete with application

Depends on eclipse/omr/#7156

By default, OpenJ9 uses an "implicit" shared class cache (SCC)
that is used to cache "bootstrap" classes and methods.
Currently, methods whose class is not present in the SCC
receive a high initial invocation count (3000/3000 for
loopless/loopy method) in order to improve steady state
throughput. However, this could affect start-up time of
applications because methods are interpreted for too long
before being JIT compiled.
The presence of `-Xshareclasses` on the command line is a sign
that the user cares about start-up time and OpenJ9 automatically
lowers the invocations counts to 1000/250. However, with the
implicit SCC (no -Xshareclasses command line option), application
classes are not cached and methods belonging to those classes
will receive a large initial invocation count (3000/3000). Since
application classes are likely important, we would like to use
lower counts even when the implict SCC is used.

This commit lowers the initial invocation counts for methods
whose class is not in SCC under the following conditions:
- SCC is used. Rationale: -Xshareclasses:none may be a sign that
user does not care about start-up that much.
- -Xtune:throughput is not used. Rationale: this option is a
clear signal that the user cares more about throughput than startup.
- The user has not provided a specific count on the command line.
- The JVM is in start-up mode. Rationale: this feature only seeks
to improve start-up time.
- The JVM runs on 4 or more vCPUs. Rationale: lower counts will
generate more compilations which will compete with application

Depends on eclipse/omr/eclipse-openj9#7156

Signed-off-by: Marius <mpirvu@ca.ibm.com>
@mpirvu
Copy link
Contributor Author

mpirvu commented Oct 27, 2023

jenkins test sanity zlinuxjit jdk17 depends eclipse/omr#7156

@vijaysun-omr
Copy link
Contributor

What is your thinking on applying lower counts during rampup phase ? i.e. in addition to startup phase.

@mpirvu
Copy link
Contributor Author

mpirvu commented Oct 27, 2023

I don't think lowering counts during rampup will improve DaCapo further. DaCapo benchmarks don't have a startup phase per-se, so the JIT estimates one, which is quite long.
Moreover, counts are set when classes are loaded. The rampup phase is characterized by many first time compilations and (especially) recompilations. When this happens, the classes have already been loaded and counts set.
A tweak could be to look at JIT startup phase (which can happen many times if the application has phase changes and loads many classes all of a sudden) as opposed to the VM start-up phase which can happen only once.

@vijaysun-omr
Copy link
Contributor

vijaysun-omr commented Oct 27, 2023

Okay I wasn't thinking so much about Dacapo alone, though obviously it is a relevant fact if lower counts during rampup might help there too. I understand the point about rampup essentially being "too late". I'll defer to your best judgement on the JIT startup vs VM startup question since I don't have a good feel about that. Either way, please let me know if/when there are to be no further changes, so that I know when to consider final review and merge.

@mpirvu
Copy link
Contributor Author

mpirvu commented Oct 30, 2023

I don't plan to do any changes at the moment so this PR can be delivered as is.
Later on I may experiment with lowering the counts during the JIT start-up phase as opposed to the VM start-up phase as it is now. This (future) change carries more risk (negatively affecting steady state throughput).

@vijaysun-omr vijaysun-omr merged commit 4ba8f3d into eclipse-openj9:master Oct 30, 2023
5 checks passed
mpirvu added a commit to mpirvu/openj9 that referenced this pull request Jan 10, 2024
PR eclipse-openj9#18356 introduced a change to reduce the counts of a method
whose class is not in the shared class cache (SCC), if SCC
is enabled and the load of that class happens during start-up.
This change improves performance of some short running benchmarks
from the DaCapo suite (when run with default options), but was
discovered to also cause a small (2-3%) throughput regression when
running the Daytrader benchmark on top of tWAS.
This commit restricts the change from PR eclipse-openj9#18356 to environments
that use an implicit SCC (by default, OpenJ9 creates an implict SCC
that is only allowed to to store bootstrap classes).

Signed-off-by: Marius Pirvu <mpirvu@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants