Skip to content

Commit 6f03917

Browse files
committed
Improve verify auto pause step and Update README.md for auto-pause benchmark
1 parent ad7b7fa commit 6f03917

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

hack/benchmark/cpu_usage/auto_pause/README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@ These scripts are for the benchmark of cpu usage, minikube vs kind vs k3d.
55
* `update_summary.sh`: create one summary csv file of each drivers and products
66
* `chart.go`: create bar chart graph as a png file
77

8-
In `benchmark_local_k8s.sh`, we compare minikube drivers(hyperkit, virtualbox, docker, docker with auto-pause) and kind, k3d, Docker for Mac Kubernetes in case of macOS.
9-
In `benchmark_local_k8s.sh`, we compare minikube drivers(kvm2, virtualbox, docker, docker with auto-pause) and kind, k3d in case of Linux.
8+
In `benchmark_local_k8s.sh`, we compare minikube drivers(hyperkit, virtualbox, docker) and kind, k3d, Docker for Mac Kubernetes in case of macOS.
9+
In `benchmark_local_k8s.sh`, we compare minikube drivers(kvm2, virtualbox, docker) and kind, k3d in case of Linux.
1010
`benchmark_local_k8s.sh` take these steps to measure `auto-pause` vs. `non auto-pause`.
1111

1212
1. start each local kubernetes tool
13-
2. deploy sample application(nginx deployment)
13+
2. deploy sample application(nginx deployment) to each tool
1414
3. wait 1 minute without anything
1515
4. measure No.3 idle CPU usage with [cstat](https://github.com/tstromberg/cstat)
16-
5. enable auto-pause addons(only if tool is minikube)
17-
6. wait 3 minute without anything
18-
7. measure No.6 idle CPU usage with [cstat](https://github.com/tstromberg/cstat)
16+
5. if tool is minikube, enable auto-pause addon which pause control plane
17+
6. if tool is minikube, wait 1 minute so that control plane will become Paused status(It takes 1 minute to become Pause status from Stopped status)
18+
7. if tool is minikube, verify if minikube control plane is paused
19+
8. if tool is minikube, wait 3 minute without anything
20+
9. if tool is minikube, measure No.8 idle CPU usage with [cstat](https://github.com/tstromberg/cstat)
21+
22+
No.1-4: Initial start CPU usage with sample(nginx) deployment
23+
No.5-9: Auto Paused CPU usage with sample(nginx) deployment
1924

2025
# How to use these scripts
2126

@@ -31,4 +36,4 @@ If you update the benchmark results to [our website](https://minikube.sigs.k8s.i
3136
git status
3237
git add <Changed png file>
3338
git commit
34-
```
39+
```

hack/benchmark/cpu_usage/auto_pause/benchmark_local_k8s.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -271,21 +271,25 @@ main() {
271271
echo "-> enable auto-pause to control plane"
272272
out/minikube addons enable auto-pause
273273

274-
# 6. wait 1 minute so that control plane will become Paused status(It takes 1 minute)
275-
sleep 65
276-
# 7. verify if minikube control plane is paused
277-
PAUSE=$(out/minikube status)
278-
echo $PAUSE | grep "apiserver: Paused"
279-
# 8. wait 3 minute without anything
280-
# 9. measure No.6 idle CPU usage
281-
if [[ "$?" == 0 ]]; then
282-
echo "kube-apiserver is paused"
283-
measure "minikube.${driver}.autopause" $i "3m" || fail "minikube.${driver}.autopause" $i
284-
else
285-
echo "failed to auto pause"
286-
fail "minikube.${driver}.autopause" $i
287-
fi
288-
274+
# 6. wait 1 minute so that control plane will become Paused status
275+
pause=0
276+
while [ "${pause}" = 0 ]
277+
do
278+
# It takes 1 minute to become Pause status from Stopped status. 70s is a number with a margin
279+
sleep 70
280+
# 7. verify if minikube control plane is paused
281+
PAUSE=$(out/minikube status)
282+
echo $PAUSE | grep "apiserver: Paused"
283+
if [[ "$?" == 0 ]]; then
284+
echo "kube-apiserver is paused"
285+
pause=1
286+
else
287+
echo "...status is not Paused. wait for becoming Pause..."
288+
fi
289+
done
290+
291+
# 8. wait 3 minute without anything and 9. measure No.8 idle CPU usage
292+
measure "minikube.${driver}.autopause" $i "3m" || fail "minikube.${driver}.autopause" $i
289293
cleanup
290294

291295
# We won't be needing docker for the remaining tests this iteration

0 commit comments

Comments
 (0)