Merge lp:~jameinel/juju-core/gomaxprocs-apiserver-1290841 into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2454 |
Proposed branch: | lp:~jameinel/juju-core/gomaxprocs-apiserver-1290841 |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
231 lines (+144/-1) 6 files modified
cmd/jujud/machine.go (+15/-0) cmd/jujud/machine_test.go (+42/-0) cmd/jujud/main.go (+1/-1) utils/export_test.go (+9/-0) utils/gomaxprocs.go (+26/-0) utils/gomaxprocs_test.go (+51/-0) |
To merge this branch: | bzr merge lp:~jameinel/juju-core/gomaxprocs-apiserver-1290841 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+211261@code.launchpad.net |
Commit message
cmd/juju/machine: Enable GOMAXPROCS(NumCPU)
As part of my scale testing work, I noticed the API server is CPU bound
in many circumstances (logging in lots of machines at the same time).
This changes it so machine agents that manage the environment (i.e. the
API Server) changes the default for GOMAXPROCS to the number of CPUs.
Description of the change
cmd/juju/machine: Enable GOMAXPROCS(NumCPU)
As part of my scale testing work, I noticed the API server is CPU bound
in many circumstances (logging in lots of machines at the same time).
However, we know that our test suite doesn't play nicely if we have
GOMAXPROCS>1. (Something about it running multiple tests concurrently
and tests that mutate global state.)
To avoid this affecting lots of code, I did it as a two phase approach.
We only will set GOMAXPROCS if
1) GOMAXPROCS isn't already set in the environment. Since that would
mean the go runtime would have already done its thing.
2) We are running in response to the jujuDMain() (so it won't trigger
in normal test suite operations.)
3) We are running JobManageEnviron, so this will only affect the API
server, and not all the other machines. (Even though it should be
fine, if we were CPU bound there, we probably don't want to
saturate machines that are running real workloads.)
I added tests that things get called properly when they are (and
aren't) enabled, but I didn't add a test that jujuDMain enables it
properly. I couldn't see an obvious way to hook into that code, so I
filed bug #1293383. Though if someone has a good way to test it, I'll
just do so.
This also has a change to how the MachineAgent works, in that it now
has a channel to let us know once it has called all of the StartWorker
steps and is going into the Wait() step. It made it possible to test
that we *didn't* call UseMultipleCPUs() for agents that aren't the API
server.
Reviewers: mp+211261_ code.launchpad. net,
Message:
Please take a look.
Description:
cmd/juju/machine: Enable GOMAXPROCS(NumCPU)
As part of my scale testing work, I noticed the API server is CPU bound
in many circumstances (logging in lots of machines at the same time).
However, we know that our test suite doesn't play nicely if we have
GOMAXPROCS>1. (Something about it running multiple tests concurrently
and tests that mutate global state.)
To avoid this affecting lots of code, I did it as a two phase approach.
We only will set GOMAXPROCS if
1) GOMAXPROCS isn't already set in the environment. Since that would
mean the go runtime would have already done its thing.
2) We are running in response to the jujuDMain() (so it won't trigger
in normal test suite operations.)
3) We are running JobManageEnviron, so this will only affect the API
server, and not all the other machines. (Even though it should be
fine, if we were CPU bound there, we probably don't want to
saturate machines that are running real workloads.)
I added tests that things get called properly when they are (and
aren't) enabled, but I didn't add a test that jujuDMain enables it
properly. I couldn't see an obvious way to hook into that code, so I
filed bug #1293383. Though if someone has a good way to test it, I'll
just do so.
This also has a change to how the MachineAgent works, in that it now
has a channel to let us know once it has called all of the StartWorker
steps and is going into the Wait() step. It made it possible to test
that we *didn't* call UseMultipleCPUs() for agents that aren't the API
server.
https:/ /code.launchpad .net/~jameinel/ juju-core/ gomaxprocs- apiserver- 1290841/ +merge/ 211261
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/76120044/
Affected files (+223, -1 lines): machine. go machine_ test.go test.go s_test. go
A [revision details]
M cmd/jujud/
M cmd/jujud/
M cmd/jujud/main.go
A utils/export_
A utils/gomaxprocs.go
A utils/gomaxproc