-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
tidb-server: introduce go.uber.org/automaxprocs
#13340
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13340 +/- ##
===========================================
Coverage 80.1608% 80.1608%
===========================================
Files 469 469
Lines 112626 112626
===========================================
Hits 90282 90282
Misses 15384 15384
Partials 6960 6960 |
LGTM |
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.
LGTM
@tennix according to Commit Message and Pull Request Style, we should use |
go.uber.org/automaxprocs
Your auto merge job has been accepted, waiting for 13354, 13209, 13166 |
/run-all-tests |
What problem does this PR solve?
This PR closes #13337 to allow auto set
GOMAXPROCS
to the CPUs tidb-server can use.What is changed and how it works?
Introducing the package
go.uber.org/automaxprocs
, this package will read cgroup system to get the CPU the process can use and adjust theGOMAXPROCS
to the CPU limit. When users already explicitly setperformance.max-procs
to non-zero, then the value provided by users will override the default value, so it does not have break change.Check List
Tests
Run tidb-server inside a kubernetes pod which has cpu limit by
GODEBUG=schedtrace=1000 ./tidb-server
, the reportedGOMAXPROCS
is exactly the cpu limits set by pod resources.Code changes
None
Side effects
None
Related changes
Release note
Auto set GOMAXPROCS in Docker container environment.