-
Notifications
You must be signed in to change notification settings - Fork 712
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
Shared cache hints for GC heap size #3743
Comments
I guess we are doing this only on gencon ? |
Maybe balanced GC too ? We have'nt done any experimenting with balanced GC to say if/how much it helps but I'd like to think that we need to stop treating balanced as a second class citizen if it's not a huge amount of extra work. |
Do we have -Xmn, -Xmo on balanced GC ? @amicic |
|
-Xmn is relevant in Balanced as much as in Gencon (although they have a bit differen meaning: total Nursery for Gencon which is both Allocate and Survivor vs only Allocate (actually called Eden) in Balanced). Bottom line, we should treat them same (we should set Xmns based on recommendation stored in SC) I thought that -Xmo had no semantical meaning in Balanced, but we do seem to obey the command and do something about it. I just did a quick test and what I can tell is that effectively ends up affecting the total heap sizing (pretty much acting as Xmx/Xms commands). See for example this: ./java -verbose:gc,sizes -Xmx64M -Xmos32M -Xgcpolicy:gencon -Xmns10880K initial new space size vs ./java -verbose:gc,sizes -Xmx64M -Xmos32M -Xgcpolicy:balanced -Xmns16M initial new space size While, having different meaning for Gencon and Balanced (old space vs all space), I think it would still be ok to use it. In short, -Xmns and Xmos could be used for both GC policies to uniquely determine initial total heap and division between Nursery/Eden vs the rest of the heap. |
However options should be applied wisely because it might depend on GC policy they were taken. Should stored values be accompanied by GC policy or we can make them invariant? |
Yes, we'll have to work out all the relevant environment options that need to match. Or we could store the entire command line.
|
We should design the data record to be extensible in the future. I think there are other values that would be interesting to store from run to run. |
Another point to consider: Most of the information stored in SCC is read only, one notable exception being the JIT hints. For most flexibility it would be best to allow RW access to these GC hints. |
We can store the main class name and GC policy. If we want to store Xmx, we might want to store Xms as well. There could be so many combinations of Xmx and Xms. |
Probably we should turn this feature off if user specified any of -Xmns/-Xmnx/-Xmn/-Xmos/-Xmox/-Xmo/-Xms/-Xmx. I guess -Xmoi, -Xmine, -Xmaxe also matter here ? |
The suggestion to store -Xmx was for the purpose of validating the hint. i.e. a different -Xmx invalidates the hint. However, I'm leaning towards storing the entire command line. As long as the command line remains the same, the gc sizing hints for that command line remain valid. There can be different hints stored for different command lines. I think storing the entire command line should be the first approach. Afterwards we could consider filtering out specific command line options as not being relevant to the GC hints, but not sure this is a necessary feature. During production I expect the command lines don't change.
Agreed. If the values are set explicitly then they shouldn't be overridden. |
Here is an example of the entire command line options if I run a simple app:
There are so many default options prepended/appended, which are not related to this feature at all. The old space and new space sizes are only two numbers, but the entire CML is such a long string. I guess it is not worth storing the whole CML, Also there is an option -Dsun.java.launcher.pid, which will be different from run to run. If GC is going to check for the presence of -Xmns/-Xmnx/-Xmn/-Xmos/-Xmox/-Xmo/-Xmx/-Xms/... and gc policy to decide whether to turn off this feature, storing the main class probably should be sufficient. |
Just the main class isn't sufficient, other parameters such as -Xmx, -Xms and gcpolicy need to be stored as well. If they change then the hint is invalidated. We can try to find a balance between parameters that matter and parameters that don't. We can filter all the default options out of the parameter list and maybe some other specific parameters as well, but in general I think if options are modified then the behavior of the app can change and invalidate the hint. |
I will save the new/old space sizes as well as the following info: Do you see any GC options that are missing here ? @amicic @dmitripivkine |
As @pshipton suggested, I would not even try to recognize various -Xm? options (or any other option). If anything in options changed, the hints would be invalidated. It would be, in general, complicated to try to interpret -Xm? options to validate that they effectively mean the same initial/total heap sizing, even though the option themselves are different. For example, these two things are effectively same:
The hints for initial heap sizing would come from internal API and have no relationship with the options. We are yet to agree what API is to be used, but effectively we need two:
|
I believe we need keep GC policy as well |
+1 this to approach. For the initial implementation, we should just validate the commandline is the same. |
Yes, I should say -Xgc and -Xgcpolicy |
OK. Then I am going the save the entire command line. |
@amicic gentle ping. Can you update this with the outlook? |
With some luck there is not much work left:
Balanced GC will not be covered in the first release. |
This is just a matter of starting a number of JVMs at approximately the same time, such as starting up 20 JVMs running the SwingSet demo. |
The option has been added for 0.15. Moving to 0.16 to consider enabling by default |
I've done some basic testing to confirm everything is order, and there are no races with first GC. |
@amicic has the concern about always writing to the cache been addressed? i.e. the GC code will only attempt to write a hint if it has calculated a different value than has already been stored to the cache? If this is addressed, I suggest we enable the feature by default just after branching for the 0.15 release, to give time to identify any problems before the next release. |
The hint is always updated. Values will almost always be different. I have not done anything to test if there is a problem with excessive updates. |
We shouldn't enable the feature by default until this has been resolved. Writing to the shared cache on every startup affects starting up multiple JVMs concurrently, as each JVM will serialize on the write to the cache. |
A multiJVM test... I used a fairly simple workload (single threaded, very few classes and methods). Started 50 JVMs simultaneously, on a machine with 120 threads. GC thread and compilation thread count reduced to 2 and 1 respectively. 4 group of tests, with 4-6 sequential runs within each group. Before each group, SC was wiped. SC alone appears to regress completion time (since the test is so simple, there is probably no benefit of SC, but there is some cost of maintaining SC?). However, use of hints does not seem to introduce additional regression. no SC SC, no hints SC, use hints SC, use hints, skip insignificant updates |
Might be the same issue as #5918. Using |
@pshipton I understand the concern. There might be a real problem, but I'm reluctant to add additional logic before observing a problem and proving the logic helps. If you or somebody else try and succeed to create a problem with their own scenarios, I'm more than willing to investigate... |
@amicic based on the results in #3743 (comment), I agree it seems fine as-is. |
@amicic do you agree to enable |
@amicic We've branched for |
As requested by eclipse-openj9/openj9#3743 (comment) (the feature is really only available in OpenJ9) Signed-off-by: Aleksandar Micic <amicic@ca.ibm.com>
PR that enables it by default has just been merged. |
Since eclipse/omr#4079 is merged, I believe this can be closed. |
Some of the methods in SymbolReferenceTable in OMR are used only by OpenJ9. Fixes: eclipse-openj9#3743 (OMR repo) Signed-off-by: Batyr Nuryyev <nuryyev@ualberta.ca>
Some of the methods in SymbolReferenceTable in OMR are used only by OpenJ9. Fixes: [eclipse-openj9#3743](eclipse/omr#3743) (in OMR repo) Signed-off-by: Batyr Nuryyev <nuryyev@ualberta.ca>
Remembering the previous heap size settings (-Xmn, -Xmo) after startup can provide a significant startup benefit in subsequent runs, and can improve footprint as well. The GC data can be stored in the shared cache as a hint.
https://unbscholar.lib.unb.ca/islandora/object/unbscholar%3A8100/datastream/PDF/view
https://ieeexplore.ieee.org/document/8121911
Since a shared cache can be used to run more than one application, which may have different heap requirements, the hint should be associated with an application, or at least a main class.
As by design the GC is initialized before the shared cache, new GC APIs will be needed to adjust the GC heap parameters after initialization. Since the heap parameters can be adjusted before any objects are created, it can happen with very low cost.
Doc issue eclipse-openj9/openj9-docs#324
The text was updated successfully, but these errors were encountered: