mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Merge pull request #37357 from gmarek/profilinig
Automatic merge from submit-queue (batch tested with PRs 36263, 36755, 37357, 37222, 37524) Add flag to enable contention profiling in scheduler. ```release-note Add flag to enable contention profiling in scheduler. ```
This commit is contained in:
commit
4bc6e717ed
File diff suppressed because it is too large
Load Diff
@ -541,6 +541,8 @@ type KubeSchedulerConfiguration struct {
|
|||||||
PolicyConfigFile string `json:"policyConfigFile"`
|
PolicyConfigFile string `json:"policyConfigFile"`
|
||||||
// enableProfiling enables profiling via web interface.
|
// enableProfiling enables profiling via web interface.
|
||||||
EnableProfiling bool `json:"enableProfiling"`
|
EnableProfiling bool `json:"enableProfiling"`
|
||||||
|
// enableContentionProfiling enables lock contention profiling, if enableProfiling is true.
|
||||||
|
EnableContentionProfiling bool `json:"enableContentionProfiling"`
|
||||||
// contentType is contentType of requests sent to apiserver.
|
// contentType is contentType of requests sent to apiserver.
|
||||||
ContentType string `json:"contentType"`
|
ContentType string `json:"contentType"`
|
||||||
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
|
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
|
||||||
|
@ -109,6 +109,8 @@ type KubeSchedulerConfiguration struct {
|
|||||||
PolicyConfigFile string `json:"policyConfigFile"`
|
PolicyConfigFile string `json:"policyConfigFile"`
|
||||||
// enableProfiling enables profiling via web interface.
|
// enableProfiling enables profiling via web interface.
|
||||||
EnableProfiling *bool `json:"enableProfiling"`
|
EnableProfiling *bool `json:"enableProfiling"`
|
||||||
|
// enableContentionProfiling enables lock contention profiling, if enableProfiling is true.
|
||||||
|
EnableContentionProfiling bool `json:"enableContentionProfiling"`
|
||||||
// contentType is contentType of requests sent to apiserver.
|
// contentType is contentType of requests sent to apiserver.
|
||||||
ContentType string `json:"contentType"`
|
ContentType string `json:"contentType"`
|
||||||
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
|
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
|
||||||
|
@ -126,6 +126,7 @@ func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSche
|
|||||||
if err := api.Convert_Pointer_bool_To_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil {
|
if err := api.Convert_Pointer_bool_To_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||||
out.ContentType = in.ContentType
|
out.ContentType = in.ContentType
|
||||||
out.KubeAPIQPS = in.KubeAPIQPS
|
out.KubeAPIQPS = in.KubeAPIQPS
|
||||||
out.KubeAPIBurst = int32(in.KubeAPIBurst)
|
out.KubeAPIBurst = int32(in.KubeAPIBurst)
|
||||||
@ -150,6 +151,7 @@ func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSche
|
|||||||
if err := api.Convert_bool_To_Pointer_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil {
|
if err := api.Convert_bool_To_Pointer_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||||
out.ContentType = in.ContentType
|
out.ContentType = in.ContentType
|
||||||
out.KubeAPIQPS = in.KubeAPIQPS
|
out.KubeAPIQPS = in.KubeAPIQPS
|
||||||
out.KubeAPIBurst = int(in.KubeAPIBurst)
|
out.KubeAPIBurst = int(in.KubeAPIBurst)
|
||||||
|
@ -105,6 +105,7 @@ func DeepCopy_v1alpha1_KubeSchedulerConfiguration(in interface{}, out interface{
|
|||||||
} else {
|
} else {
|
||||||
out.EnableProfiling = nil
|
out.EnableProfiling = nil
|
||||||
}
|
}
|
||||||
|
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||||
out.ContentType = in.ContentType
|
out.ContentType = in.ContentType
|
||||||
out.KubeAPIQPS = in.KubeAPIQPS
|
out.KubeAPIQPS = in.KubeAPIQPS
|
||||||
out.KubeAPIBurst = in.KubeAPIBurst
|
out.KubeAPIBurst = in.KubeAPIBurst
|
||||||
|
@ -188,6 +188,7 @@ func DeepCopy_componentconfig_KubeSchedulerConfiguration(in interface{}, out int
|
|||||||
out.AlgorithmProvider = in.AlgorithmProvider
|
out.AlgorithmProvider = in.AlgorithmProvider
|
||||||
out.PolicyConfigFile = in.PolicyConfigFile
|
out.PolicyConfigFile = in.PolicyConfigFile
|
||||||
out.EnableProfiling = in.EnableProfiling
|
out.EnableProfiling = in.EnableProfiling
|
||||||
|
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||||
out.ContentType = in.ContentType
|
out.ContentType = in.ContentType
|
||||||
out.KubeAPIQPS = in.KubeAPIQPS
|
out.KubeAPIQPS = in.KubeAPIQPS
|
||||||
out.KubeAPIBurst = in.KubeAPIBurst
|
out.KubeAPIBurst = in.KubeAPIBurst
|
||||||
|
@ -2063,6 +2063,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||||||
Format: "",
|
Format: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"enableContentionProfiling": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "enableContentionProfiling enables lock contention profiling, if enableProfiling is true.",
|
||||||
|
Type: []string{"boolean"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
"contentType": {
|
"contentType": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "contentType is contentType of requests sent to apiserver.",
|
Description: "contentType is contentType of requests sent to apiserver.",
|
||||||
@ -2112,7 +2119,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "enableContentionProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Dependencies: []string{
|
Dependencies: []string{
|
||||||
@ -13925,6 +13932,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||||||
Format: "",
|
Format: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"enableContentionProfiling": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "enableContentionProfiling enables lock contention profiling, if enableProfiling is true.",
|
||||||
|
Type: []string{"boolean"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
"contentType": {
|
"contentType": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "contentType is contentType of requests sent to apiserver.",
|
Description: "contentType is contentType of requests sent to apiserver.",
|
||||||
@ -13974,7 +13988,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "enableContentionProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Dependencies: []string{
|
Dependencies: []string{
|
||||||
|
@ -60,6 +60,7 @@ func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
|
|||||||
fs.StringVar(&s.AlgorithmProvider, "algorithm-provider", s.AlgorithmProvider, "The scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
|
fs.StringVar(&s.AlgorithmProvider, "algorithm-provider", s.AlgorithmProvider, "The scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
|
||||||
fs.StringVar(&s.PolicyConfigFile, "policy-config-file", s.PolicyConfigFile, "File with scheduler policy configuration")
|
fs.StringVar(&s.PolicyConfigFile, "policy-config-file", s.PolicyConfigFile, "File with scheduler policy configuration")
|
||||||
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
|
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
|
||||||
|
fs.BoolVar(&s.EnableContentionProfiling, "contention-profiling", false, "Enable lock contention profiling, if profiling is enabled")
|
||||||
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
|
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
|
||||||
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
|
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
|
||||||
fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "Content type of requests sent to apiserver.")
|
fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "Content type of requests sent to apiserver.")
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
|
goruntime "runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
@ -103,6 +104,9 @@ func Run(s *options.SchedulerServer) error {
|
|||||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||||
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||||
|
if s.EnableContentionProfiling {
|
||||||
|
goruntime.SetBlockProfileRate(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
configz.InstallHandler(mux)
|
configz.InstallHandler(mux)
|
||||||
mux.Handle("/metrics", prometheus.Handler())
|
mux.Handle("/metrics", prometheus.Handler())
|
||||||
|
Loading…
Reference in New Issue
Block a user