-
Notifications
You must be signed in to change notification settings - Fork 38
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
Issue 130: Ability to specify container resources #129
Conversation
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Signed-off-by: wenqi <Wenqi.Mou@emc.com>
Signed-off-by: wenqi <Wenqi.Mou@emc.com>
Signed-off-by: wenqi <Wenqi.Mou@emc.com>
* master: Run tests on GKE (#140)
* master: Issue 134,137: Fix BookKeeper errors (#135)
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
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.
Looks good, some comments.
changed = true | ||
s.Resources = &v1.ResourceRequirements{ | ||
Requests: v1.ResourceList{ | ||
v1.ResourceCPU: resource.MustParse("500m"), |
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.
Why these values are lower than the ones in cr-detailed.yaml
? Shall we stick to a consistent defaults?
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.
The default values are meant to represent the bare minimum requirements for Pravega to run. These values are intended to be use in a first contact with Pravega, functional testing, or development work. Therefore, we want to keep them low so that Pravega can be deployed to small Kubernetes clusters. Whereas the values in cr-detailed.yaml
are just an example of how the default resources would be overridden to tune Pravega resources to a higher performance cluster.
pkg/apis/pravega/v1alpha1/pravega.go
Outdated
changed = true | ||
s.ControllerResources = &v1.ResourceRequirements{ | ||
Requests: v1.ResourceList{ | ||
v1.ResourceCPU: resource.MustParse("250m"), |
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 comment here with the defaults compared to cr-detailed.yaml
.
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.
Responded in #129 (comment)
javaOpts := []string{ | ||
"-Xms1g -Xmx4g -XX:MaxDirectMemorySize=1g -Dpravegaservice.clusterName=" + pravegaCluster.Name, | ||
"-Xms1g", | ||
"-XX:+UnlockExperimentalVMOptions", |
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.
Are these options configurable as part of another PR, right?
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.
No, JVM options are not externally configurable.
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, this may not be great, because we will rely on the default -Xmx
value set by the JVM implementation. The default may be set as follows:
Often its default value is 1/4th of your physical memory or 1GB (whichever is smaller).
So, we may end up providing 4GBs of memory to a pod, but 1GB at most will be devoted to the JVM (despite the main purpose of that pod is to run the JVM for the Pravega process at hand). What is your opinion about this? Have you used -XX:+PrintFlagsFinal
to see what is the actual -Xmx
value that is being used? Would it make sense to set the -Xmx
value in function to the provisioned memory resources for the pod?
@@ -12,6 +12,13 @@ spec: | |||
pullPolicy: IfNotPresent | |||
|
|||
replicas: 3 | |||
resources: |
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.
Is there any test that validates that these values are properly passed to the 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.
No, we will work on adding a test to validate that resources are passed down to pod templates correctly.
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.
Test added. Could you please review it again? Thanks!
Signed-off-by: wenqi <Wenqi.Mou@emc.com>
Signed-off-by: wenqi <Wenqi.Mou@emc.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
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.
@Tristan1900 awesome work adding the test cases. Thanks!
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 have one comment that may be relevant for JVM provisioning.
javaOpts := []string{ | ||
"-Xms1g -Xmx4g -XX:MaxDirectMemorySize=1g -Dpravegaservice.clusterName=" + pravegaCluster.Name, | ||
"-Xms1g", | ||
"-XX:+UnlockExperimentalVMOptions", |
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, this may not be great, because we will rely on the default -Xmx
value set by the JVM implementation. The default may be set as follows:
Often its default value is 1/4th of your physical memory or 1GB (whichever is smaller).
So, we may end up providing 4GBs of memory to a pod, but 1GB at most will be devoted to the JVM (despite the main purpose of that pod is to run the JVM for the Pravega process at hand). What is your opinion about this? Have you used -XX:+PrintFlagsFinal
to see what is the actual -Xmx
value that is being used? Would it make sense to set the -Xmx
value in function to the provisioned memory resources for the pod?
@RaulGracia that's exactly what |
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.
LGTM.
Signed-off-by: wenqi <Wenqi.Mou@emc.com>
Signed-off-by: Adrián Moreno <adrian@morenomartinez.com>
Change log description
This PR will bring the following changes:
Xmx
JVM option with the dynamic, Docker-aware flags-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
which will set the heap memory size to the given Pod memory limit. (Ref: https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits)At this moment, the PR is being used for testing with the goal of finding the suitable values for resource requests and limits.
Purpose of the change
Fix #130
How to test the change
When defining the Pravega cluster specification in the YAML file, include the following options to set custom resource requests and limits for each Pravega component.
You can verify that those values have been correctly set by looking at the Pods description.
Signed-off-by: Adrián Moreno adrian@morenomartinez.com