mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #107677 from pohly/scheduler-integration-benchmark
scheduler integration benchmark improvements
This commit is contained in:
commit
21c0f6f6ff
@ -19,6 +19,10 @@
|
||||
ETCD_VERSION=${ETCD_VERSION:-3.5.1}
|
||||
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
||||
ETCD_PORT=${ETCD_PORT:-2379}
|
||||
# This is intentionally not called ETCD_LOG_LEVEL:
|
||||
# etcd checks that and compains when it is set in addition
|
||||
# to the command line argument, even when both have the same value.
|
||||
ETCD_LOGLEVEL=${ETCD_LOGLEVEL:-debug}
|
||||
export KUBE_INTEGRATION_ETCD_URL="http://${ETCD_HOST}:${ETCD_PORT}"
|
||||
|
||||
kube::etcd::validate() {
|
||||
@ -82,8 +86,8 @@ kube::etcd::start() {
|
||||
else
|
||||
ETCD_LOGFILE=${ETCD_LOGFILE:-"/dev/null"}
|
||||
fi
|
||||
kube::log::info "etcd --advertise-client-urls ${KUBE_INTEGRATION_ETCD_URL} --data-dir ${ETCD_DIR} --listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} --log-level=debug > \"${ETCD_LOGFILE}\" 2>/dev/null"
|
||||
etcd --advertise-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --data-dir "${ETCD_DIR}" --listen-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --log-level=debug 2> "${ETCD_LOGFILE}" >/dev/null &
|
||||
kube::log::info "etcd --advertise-client-urls ${KUBE_INTEGRATION_ETCD_URL} --data-dir ${ETCD_DIR} --listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} --log-level=${ETCD_LOGLEVEL} 2> \"${ETCD_LOGFILE}\" >/dev/null"
|
||||
etcd --advertise-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --data-dir "${ETCD_DIR}" --listen-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --log-level="${ETCD_LOGLEVEL}" 2> "${ETCD_LOGFILE}" >/dev/null &
|
||||
ETCD_PID=$!
|
||||
|
||||
echo "Waiting for etcd to come up."
|
||||
|
@ -135,6 +135,6 @@ func GetNamespaceLabelsSnapshot(ns string, nsLister listersv1.NamespaceLister) (
|
||||
// Create and return snapshot of the labels.
|
||||
return labels.Merge(podNS.Labels, nil)
|
||||
}
|
||||
klog.ErrorS(err, "getting namespace, assuming empty set of namespace labels", "namespace", ns)
|
||||
klog.V(3).InfoS("getting namespace, assuming empty set of namespace labels", "namespace", ns, "err", err)
|
||||
return
|
||||
}
|
||||
|
@ -65,6 +65,13 @@ const (
|
||||
UnprivilegedUserToken = "unprivileged-user"
|
||||
)
|
||||
|
||||
// MinVerbosity determines the minimum klog verbosity when running tests that
|
||||
// involve the apiserver. This overrides the -v value from the command line,
|
||||
// i.e. -v=0 has no effect when MinVerbosity is 4 (the default). Tests can opt
|
||||
// out of this by setting MinVerbosity to zero before starting the control
|
||||
// plane or choose some different minimum verbosity.
|
||||
var MinVerbosity = 4
|
||||
|
||||
// Config is a struct of configuration directives for NewControlPlaneComponents.
|
||||
type Config struct {
|
||||
// If nil, a default is used, partially filled configs will not get populated.
|
||||
@ -139,11 +146,11 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer
|
||||
var m *controlplane.Instance
|
||||
var s *httptest.Server
|
||||
|
||||
// Ensure we log at least level 4
|
||||
// Ensure we log at least at the desired level
|
||||
v := flag.Lookup("v").Value
|
||||
level, _ := strconv.Atoi(v.String())
|
||||
if level < 4 {
|
||||
v.Set("4")
|
||||
if level < MinVerbosity {
|
||||
v.Set(strconv.Itoa(MinVerbosity))
|
||||
}
|
||||
|
||||
if incomingServer != nil {
|
||||
|
@ -36,14 +36,14 @@ How To Run
|
||||
|
||||
```shell
|
||||
# In Kubernetes root path
|
||||
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=true -logtostderr=true -run=." KUBE_TIMEOUT="--timeout=60m" SHORT="--short=false"
|
||||
make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=true -logtostderr=true -run=." KUBE_TIMEOUT="--timeout=60m" SHORT="--short=false"
|
||||
```
|
||||
|
||||
## Benchmark tests
|
||||
|
||||
```shell
|
||||
# In Kubernetes root path
|
||||
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling"
|
||||
make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling"
|
||||
```
|
||||
|
||||
The benchmark suite runs all the tests specified under config/performance-config.yaml.
|
||||
@ -58,14 +58,14 @@ Otherwise, the golang benchmark framework will try to run a test more than once
|
||||
|
||||
```shell
|
||||
# In Kubernetes root path
|
||||
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule"
|
||||
make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule"
|
||||
```
|
||||
|
||||
To produce a cpu profile:
|
||||
|
||||
```shell
|
||||
# In Kubernetes root path
|
||||
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TIMEOUT="-timeout=3600s" KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out"
|
||||
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TIMEOUT="-timeout=3600s" ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out"
|
||||
```
|
||||
|
||||
### How to configure benchmark tests
|
||||
|
@ -373,7 +373,7 @@
|
||||
initPods: 2000
|
||||
measurePods: 1000
|
||||
|
||||
- name: Preemption
|
||||
- name: PreemptionBasic
|
||||
workloadTemplate:
|
||||
- opcode: createNodes
|
||||
countParam: $initNodes
|
||||
|
@ -537,7 +537,7 @@ func BenchmarkPerfScheduling(b *testing.B) {
|
||||
})
|
||||
}
|
||||
if err := dataItems2JSONFile(dataItems, b.Name()); err != nil {
|
||||
klog.Fatalf("%v: unable to write measured data: %v", b.Name(), err)
|
||||
klog.Fatalf("%v: unable to write measured data %+v: %v", b.Name(), dataItems, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ import (
|
||||
"k8s.io/kube-scheduler/config/v1beta2"
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||
kubeschedulerscheme "k8s.io/kubernetes/pkg/scheduler/apis/config/scheme"
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
"k8s.io/kubernetes/test/integration/util"
|
||||
testutils "k8s.io/kubernetes/test/utils"
|
||||
)
|
||||
@ -74,6 +75,8 @@ func newDefaultComponentConfig() (*config.KubeSchedulerConfiguration, error) {
|
||||
// Notes on rate limiter:
|
||||
// - client rate limit is set to 5000.
|
||||
func mustSetupScheduler(config *config.KubeSchedulerConfiguration) (util.ShutdownFunc, coreinformers.PodInformer, clientset.Interface, dynamic.Interface) {
|
||||
// Run API server with minimimal logging by default. Can be raised with -v.
|
||||
framework.MinVerbosity = 0
|
||||
apiURL, apiShutdown := util.StartApiserver()
|
||||
var err error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user