-
Notifications
You must be signed in to change notification settings - Fork 129
[Issue 84]fix cpu and mem in docker for Linux #81
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
Conversation
caigy
left a comment
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.
Also link the PR with related issue and rename the title starting with '[ISSUE xx]'
images/namesrv/alpine/Dockerfile
Outdated
| curl https://archive.apache.org/dist/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip -o rocketmq.zip; \ | ||
| curl https://archive.apache.org/dist/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip.asc -o rocketmq.zip.asc; \ | ||
| curl https://www.apache.org/dist/rocketmq/KEYS -o KEYS; \ | ||
| curl https://downloads.apache.org/rocketmq/KEYS -o KEYS; \ |
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.
Could you provide the reason to change it? It seems that this modification is not related to the title
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.
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 is indeed a problem. I think you can use curl -L to solve the redirect problem, which is the same as that in rocketmq-docker repo.
| podAntiAffinity = &corev1.PodAntiAffinity{ | ||
| RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{corev1.PodAffinityTerm{ | ||
| TopologyKey: "kubernetes.io/hostname", | ||
| LabelSelector: &metav1.LabelSelector{ | ||
| MatchLabels: ls, | ||
| }, | ||
| }}, | ||
| PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{corev1.WeightedPodAffinityTerm{ | ||
| Weight: 100, | ||
| PodAffinityTerm: corev1.PodAffinityTerm{ | ||
| TopologyKey: "kubernetes.io/hostname", | ||
| LabelSelector: &metav1.LabelSelector{ | ||
| MatchLabels: labelsForBroker(broker.Name), | ||
| }, | ||
| }, | ||
| }}, | ||
| } |
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.
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 no idea why the nodeAffinity is needed. But the podAntiAffinity is sure needed. Because I don't want to see that the whole cluster(maybe multi master borker) become unwritable when all the master broker are assigned to the same node and the node is down. This situation will be worse if the kubernetes can't new the master pod in time.
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.
You'b better open another PR to do it, because this is obviously unrelated to this issue.
| system_memory_in_mb=$(($(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)/1024/1024)) | ||
| system_cpu_cores=$(($(cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us)/100000)) |
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 would be better to check memory and cpu from cgroup are smaller than system memory and cpu, because resource limits may not be set.
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 is better,and I fixed it.Although i think it's not correct if anone use it in the kubernetes without memory limit.
This reverts commit 5415810.
| system_memory_in_mb=$system_memory_in_mb_in_docker | ||
| fi | ||
| system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo` | ||
| system_cpu_cores_in_docker=$(($(cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us)/100000)) |
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 100000 read from /sys/fs/cgroup/cpu/cpu.cfs_period_us ?
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.
that's right,and fixed
|
@overstep123 Pls link the PR to related issue and rename the title starting with '[ISSUE xx]'. |

Uh oh!
There was an error while loading. Please reload this page.