Tune JITServer AOT cache - #14207
Conversation
|
@AlexeyKhrabrov could you please review this PR related to JITServer AOT cache? Thanks |
AlexeyKhrabrov
left a comment
There was a problem hiding this comment.
The changes make sense to me in general. I have a few questions/comments below. Also, there is a typo in the last commit message: headears -> headers.
- Here: https://github.com/mpirvu/openj9/blob/707a45d43d0afc4ab15fc8a4432f8081a958ac9b/runtime/compiler/control/CompilationThread.cpp#L11595 the behaviour depends on the global (not per-compilation)
disableDelayRelocationForAOTCompilationsoption. I'm not sure if this needs to be changed with the new heuristic for AOT cache loads not being delayed.
There was a problem hiding this comment.
How was the default value 32 chosen? Are there any experiments to support that this value makes the right trade-off between GCR overhead and AOT cache hit rate? Also, it will likely need to be updated (made smaller) if the GCR overhead is ever reduced.
There was a problem hiding this comment.
Yes, the 32 value was chosen based on experiments where load is applied to a single JVM. Further experiments with 8 JVMs in parallel show that a value of 0 is best. I am going to change the default value to 0.
There was a problem hiding this comment.
So if the default is 0, this heuristic is disabled by default. Based on your experiments, it seems to only be useful when the JITServer handles a small number of clients, which is the opposite of when the AOT cache is most useful. I'm wondering if we should try to distinguish the cases of "small" and "large" number of clients, rather than have this off-by-default knob that is unlikely to actually be used.
There was a problem hiding this comment.
According to the commit message, there is another place in the code that handles this, but less frequently. Where does that happen? Shouldn't the existing less frequent check be removed?
There was a problem hiding this comment.
I could remove it, though that other code handles turning counting both ON and OFF, so I should probably add a comment that the OFF part has been moved elsewhere.
There was a problem hiding this comment.
Looking at the code, the part that turns off counting at a coarser granularity (every 0.5 sec) also looks at the JIT state. It must be done there after the current state is decided. Hence, we should not remove that code.
In the current implementation, in order for JITServer to send a serialized AOT body from its cache, the compilation at the client must be an AOT compilation. Thus, currently, if we want to maximize the usage of the JITServer AOT cache we must use -Xaot:forceaot at the client. This commit eliminates this restriction. If -XX:JITServerUseAOTCache option is present at the client, the client will try to generate as much AOT as possible, but still keep the cheap compilations local in order to avoid network latency. Signed-off-by: Marius Pirvu <mpirvu@ca.ibm.com>
…s used This change results in better rampup performance Signed-off-by: Marius Pirvu <mpirvu@ca.ibm.com>
|
Review comments addressed. @dsouzai Could you please review/merge this PR? Thanks |
|
jenkins test sanity zlinux,xlinuxjit,plinuxjit,zlinuxjit jdk17 |
@mpirvu there's a location that should be guarded by the jitserver ifdef; causes a build break on non-jitserver builds. |
…ions This commit implements two changes: 1. vlog compilation starts will now include the keywork "remote" if the compilation will be offloaded to JITServer 2. vlog compilation ends will include the keyword "deserialized" if the compilation was offloaded to JITServer which responded with a serialized method body from its AOT cache Signed-off-by: Marius Pirvu <mpirvu@ca.ibm.com>
Generating too many AOT bodies can be detrimental for rampup due to the GCR recompilation mechanism which can add a lot of runtime overhead once all those bodies start counting. This commit limits the number of AOT compilations when JITServer AOT caching is used. The idea is that small methods may take little time to compile and we don't have to use the JITServer AOT cache for them because the savings would be too small. Therefore we can afford to JIT compile them remotely. Which methods are small enough is determined by the newly introduced option -Xjit:smallMethodBytecodeSizeThresholdForJITServerAOTCache=<N> The default value for this option is 0, which means disabled. Experiments have shown that, in some cases, small rampup improvements can be had with this option set to 32. Signed-off-by: Marius Pirvu <mpirvu@ca.ibm.com>
OpenJ9 turns off counting for GCR (counted guarded recompilation) if too many GCR induced compilation requests are queued. The problem with the current implementation is that the decision to turn off counting is done every 0.5 seconds, and in half a second very many GCR induced recompilations can be queued. This commit changes the granularity of checking whether GCR counting should be turned off to the period of the sampling thread, which is typically around 10 ms. Signed-off-by: Marius Pirvu <mpirvu@ca.ibm.com>
Signed-off-by: Marius Pirvu <mpirvu@ca.ibm.com>
|
jenkins test sanity zlinux,xlinuxjit,plinuxjit,zlinuxjit jdk17 |
|
Test_openjdk17_j9_sanity.functional_s390x_linux_jit_Personal and Test_openjdk17_j9_sanity.functional_x86-64_linux_jit_Personal failed due to infra issues, though that's only true for one of the two testlists in each; the other testlist passed 100%. |
This PR implements several commits that improves the performance of JITServer AOT cache.
The most important changes are: