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

Correctly account for cpu usage by background threads #4074

Merged
merged 3 commits into from Oct 23, 2018

Conversation

2 participants
@richvdh
Member

richvdh commented Oct 19, 2018

Wrap calls to deferToThread() in a thing which uses a child logcontext to
attribute CPU usage to the right request.

While we're in the area, remove the logcontext_tracer stuff, which is never
used, and afaik doesn't work.

Fixes #4064

Correctly account for cpu usage by background threads
Wrap calls to deferToThread() in a thing which uses a child logcontext to
attribute CPU usage to the right request.

While we're in the area, remove the logcontext_tracer stuff, which is never
used, and afaik doesn't work.

Fixes #4064

@richvdh richvdh requested a review from matrix-org/synapse-core Oct 19, 2018

@richvdh

This comment has been minimized.

Member

richvdh commented Oct 20, 2018

looks like this breaks things :/

@richvdh richvdh removed the request for review from matrix-org/synapse-core Oct 20, 2018

@richvdh richvdh requested a review from matrix-org/synapse-core Oct 22, 2018

@erikjohnston

Can we do something to reduce the boiler plate? It makes it hard to follow if everything starts with self.hs.get_reactor(), self.hs.get_reactor().getThreadPool(). Could we maybe make defer_to_threadpool take a hs object? Or even just the reactor and call getThreadPool() on it inside the function?

Otherwise looks good.

Reduce boilerplate
add another wrapper which removes the getThreadPool boilerplate
@richvdh

This comment has been minimized.

Member

richvdh commented Oct 23, 2018

fair point. ptal.

@richvdh richvdh requested a review from erikjohnston Oct 23, 2018

@erikjohnston

Thanks, that seems more readable 👍

@richvdh richvdh merged commit 5c44511 into develop Oct 23, 2018

6 checks passed

ci/circleci: sytestpy2merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgresmerged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgresmerged Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@richvdh richvdh added this to To Do in Backend Core Team via automation Oct 25, 2018

@richvdh richvdh moved this from To Do to Done - Operations in Backend Core Team Oct 25, 2018

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