Skip to content
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

koordlet: improve koordlet profiling and logs #1180

Merged
merged 1 commit into from
Apr 10, 2023
Merged

koordlet: improve koordlet profiling and logs #1180

merged 1 commit into from
Apr 10, 2023

Conversation

xigang
Copy link
Contributor

@xigang xigang commented Apr 5, 2023

Ⅰ. Describe what this PR does

koordlet: improve koordlet profiling and logs.

Ⅱ. Does this pull request fix one issue?

NONE

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@eahydra @jasonliu747

V. Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in make test

@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (2d6ad79) 65.72% compared to head (06f104f) 65.73%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1180   +/-   ##
=======================================
  Coverage   65.72%   65.73%           
=======================================
  Files         290      290           
  Lines       30646    30648    +2     
=======================================
+ Hits        20143    20146    +3     
  Misses       9023     9023           
+ Partials     1480     1479    -1     
Flag Coverage Δ
unittests 65.73% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/koordlet/config/config.go 44.64% <0.00%> (-1.66%) ⬇️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@xigang
Copy link
Contributor Author

xigang commented Apr 6, 2023

/cc @zwzhang0107 @saintube Take a look.

)

func installHandlerForPProf(mux *http.ServeMux) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why no longer use _ "net/http/pprof"

Copy link
Contributor Author

@xigang xigang Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saintube profiling server add the timeout time to protect the service from attack.

const (
	// ReadHeaderTimeout is the amount of time allowed to read
	// request headers.
	// HTTP timeouts are necessary to expire inactive connections
	// and failing to do so might make the application vulnerable
	// to attacks like slowloris which work by sending data very slow,
	// which in case of no timeout will keep the connection active
	// eventually leading to a denial-of-service (DoS) attack.
	// References:
	// - https://en.wikipedia.org/wiki/Slowloris_(computer_security)
	ReadHeaderTimeout = 32 * time.Second
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind keeping the default registration of the pprof? We may not need to register the handlers manually. The timeout time can still be set by creating a server with http.DefaultServeMux.

Copy link
Contributor Author

@xigang xigang Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind keeping the default registration of the pprof? We may not need to register the handlers manually. The timeout time can still be set by creating a server with http.DefaultServeMux.

@saintube Custom profliing server has been removed. If that's all right, need to /approve:)

ServerAddr = flag.String("addr", ":9316", "port of koordlet server")
EnablePprof = flag.Bool("enable-pprof", false, "Enable pprof for koordlet.")
PprofAddr = flag.String("pprof-addr", ":9317", "The address the pprof binds to.")
KubeAPIQPS = flag.Float64("kube-api-qps", 40.0, "QPS to use while talking with kube-apiserver.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about keeping the default QPS and Burst the same as the previous config (20, 30)

Copy link
Contributor Author

@xigang xigang Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saintube QPS and burst have been set to default values.

@xigang
Copy link
Contributor Author

xigang commented Apr 7, 2023

/cc @saintube Please take a look again:)

Signed-off-by: xigang <wangxigang2014@gmail.com>
@saintube
Copy link
Member

/lgtm

@zwzhang0107
Copy link
Contributor

/lgtm
/approve

Copy link
Member

@jasonliu747 jasonliu747 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hormes, jasonliu747, zwzhang0107

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@saintube
Copy link
Member

/area koordlet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants