-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Jenkins memory usage tuning documentation #6981
Jenkins memory usage tuning documentation #6981
Conversation
@bparees all this is just preparing the ground, but I'd appreciate feedback as I'm intending to build on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a fine start for documenting the knobs. Regarding discussing how the variables interact (e.g. container_heap_percent, java_max_heap, and jenkins_java_options), I think rather than discussing it within each variable description, it would be good to have an entire section dedicated to discussing how those variables interact/override each other/etc.
|
||
* `JENKINS_JAVA_OPTIONS` | ||
+ | ||
Specifies additional options for the Jenkins JVM which may be overridden. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs more details. If the user sets this, they are replacing all the JVM options we auto-configured and the only JVM options Jenkins will get are whatever they set in this variable (meaning they must explicitly set max heap and anything else they care about):
https://github.com/openshift/jenkins/blob/master/2/contrib/s2i/run#L320-L322
Also not clear what "which may be overridden" means. Overridden by who/what, and how are they overridden?
"false". | ||
* `JENKINS_JAVA_OVERRIDES` | ||
+ | ||
Specifies additional options for the Jenkins JVM which may not be overridden. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what really needs to be said here is that these JVM options will appear last in the JVM arguments, meaning they will/can override arguments provided earlier (such as via the automatically generated arguments that appear in JENKINS_JAVA_OPTIONS, or the arguments set by the user in JENKINS_JAVA_OPTIONS if they chose to set it explicitly).
Also worth distinguishing that unlike JENKINS_JAVA_OPTIONS, there is no "default/automatic" value for JENKINS_JAVA_OVERRIDES so if they choose to set this value, they are not erasing any arguments the image would have normally supplied. (They may, however, be overriding values the image is trying to supply).
* `JAVA_MAX_HEAP_PARAM` | ||
+ | ||
If set, entirely overrides the Jenkins JVM maximum heap size (-Xmx). Example | ||
setting: `-Xmx512m`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to discuss how this interacts with JENKINS_JAVA_OPTIONS and JENKINS_JAVA_OVERRIDES. And CONTAINER_HEAP_PERCENT.
* `CONTAINER_HEAP_PERCENT` (default: `0.5`, i.e. 50%) | ||
+ | ||
Specifies the percentage of the container memory limit allocated to the Jenkins | ||
JVM maximum heap size (-Xmx). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to discuss how this interacts with JAVA_MAX_HEAP_PARAM, JENKINS_JAVA_OPTIONS, and JENKINS_JAVA_OVERRIDES.
* `JAVA_INITIAL_HEAP_PARAM` | ||
+ | ||
If set, entirely overrides the Jenkins JVM initial heap size (-Xms). Example | ||
setting: `-Xms32m`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as for JAVA_MAX_HEAP_PARAM
+ | ||
If set, specifies the Jenkins JVM initial heap size (-Xms) as a percentage of | ||
the dynamically calculated Jenkins JVM maximum heap size value. Example | ||
setting: `0.1`, i.e. 10%. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as CONTAINER_HEAP_PERCENT
* `JAVA_GC_OPTS` (default: `-XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90`) | ||
+ | ||
Specifies Jenkins JVM garbage collection parameters. It is not recommended to | ||
override this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discuss how this interacts with JENKINS_JAVA_OPTIONS and JENKINS_JAVA_OVERRIDES.
They are available by default in the Jenkins image. | ||
|
||
[[jenkins-pipeline-dsl-plug-in]] | ||
=== {product-title} Jenkins Pipeline DSL Plug-in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we tend to call this the Jenkins OpenShift Client Plug-in when discussing it, i'd prefer to call it that here. (though I see the github repo doesn't reflect that). But it is what it's indexed as:
https://wiki.jenkins.io/display/JENKINS/OpenShift+Client+Plugin
So we should just fix the readme in the repo. (maybe @gabemontero can take care of that).
809abd8
to
396d0b6
Compare
396d0b6
to
7bf0da2
Compare
|
||
- The memory request value, if specified, influences the {product-title} scheduler. | ||
The scheduler considers the memory request when scheduling a container to a | ||
node, then ring-fences the requested memory on the chosen node for the use of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ring-fences"? probably too technical a term here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you think of a better term?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclusively allocates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to avoid "allocates" as it clashes with the idea of memory being actually allocated from the operating system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ensures the availability of"
|
||
- If the memory allocated by all of the processes in a container | ||
exceeds the memory limit, the node OOM killer will immediately select | ||
and kill a process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kill a process in the container.
+ | ||
This | ||
option involves hard-coding a value, but has the advantage of allowing | ||
a safety margin to be calculated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing period
return heap memory to the operating system whenever allocated memory | ||
exceeds 110% of in-use memory (`-XX:MaxHeapFreeRatio`), spending up to | ||
20% of CPU time in the garbage collector (`-XX:GCTimeRatio`). Detailed | ||
additional information is available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't min heapsize also play a role in this? (if min heap==max heap, i don't think anything will be released, for example because the jvm won't try to compact the heap)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will update. I'm still not 100% convinced we've got the right GC arguments but am not going to let it hold up this doc.
|
||
Many Java tools use different environment variables (`JAVA_OPTS`, | ||
`GRADLE_OPTS`, `MAVEN_OPTS`, etc.) to configure their JVMs and it can be | ||
bewildering to ensure that the right settings are being passed to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while i appreciate the sentiment, describing something as "bewildering" probably doesn't belong in technical documentation :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try "challenging" :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me.
endif::[] | ||
|
||
[[using-the-jenkins-kubernetes-plug-in]] | ||
=== Using the Jenkins Kubernetes Plug-in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section feels like it belongs as part of https://docs.openshift.org/latest/dev_guide/dev_tutorials/openshift_pipeline.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or some refactoring between the two at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Cop out perhaps, but I'm inclined to write a trello card to handle that. What I've written here is specifically kubernetes plugin syntax which IMO is sufficiently fiddly that it desperately needs written examples. https://docs.openshift.org/latest/dev_guide/dev_tutorials/openshift_pipeline.html is a openshift (DSL) client plugin walkthrough which doesn't use the kubernetes plugin. Then there's a separate pipeline plugin walkthrough at https://github.com/openshift/origin/blob/master/examples/jenkins/README.md. All three need rationalisation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the interim, I will link https://docs.openshift.org/latest/dev_guide/dev_tutorials/openshift_pipeline.html from this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=== Memory Requirements | ||
|
||
The default memory limit for the Jenkins container is 512MiB, regardless of | ||
whether the Jenkins Ephemeral or Jenkins Persistent template is being used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rephrase this as: "When deployed via the provided Jenkins Template (both ephemeral and persistent), the default memory limit is 512MiB"
To make it clear up front this is just talking about the template behavior, not the image.
[[tutorial]] | ||
== Tutorial | ||
=== Tutorial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section doesn't feel like a tutorial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - that's what was there before, though. Think I'll rename it as information about the sample job.
7bf0da2
to
79f6ead
Compare
Overview written and all requested updates made, ptal. |
lgtm |
@jim-minter LGTM. There are just a few minor edits I'd like to make, but I'll open a follow-up PR for those. Would you mind squashing your commits? Thanks! :) |
…emory add application memory sizing document
79f6ead
to
502e487
Compare
Thanks @bmcelvee. Squashed! |
[rev_history] |
…d env vars and memory add application memory sizing document (cherry picked from commit 502e487) xref:openshift#6981
…nd env vars and memory add application memory sizing document (cherry picked from commit 502e487) xref:openshift#6981
…nv vars and memory add application memory sizing document (cherry picked from commit 502e487) xref:openshift#6981
@jim-minter @bmcelvee - I made some changes to the jenkins.adoc file due to some conflicts that were unresolved. I want to make sure that the file contains content correct for 3.9 and 3.7 respectively. Could you please review them here for 3.9: And here for 3.7: |
@vikram-redhat Is this a content leak into 3.7? I didn't have conflicts on this PR or the follow-up PR when I was working on them, and I don't see anything in the blame for 3.7 or 3.9. Do you have a commit or PR that I can review for more information? Thanks! |
Hey @bmcelvee not a content leak, but unresolved conflict resolution. See here: https://github.com/openshift/openshift-docs/pull/7126/files#r170095649. I have fixed and pushed the changes, so if you could confirm that the changes that I did for both 3.7 and 3.9 branches are ok. |
No description provided.