controllers/runs: stop embedding full job objects in run response - #143
Closed
djgalloway wants to merge 1 commit into
Closed
controllers/runs: stop embedding full job objects in run response#143djgalloway wants to merge 1 commit into
djgalloway wants to merge 1 commit into
Conversation
`GET /runs/<name>/` was calling `self.run.get_jobs()` which loads every job row in full — including large text/JSON columns like `overrides`, `tasks`, `roles`, and `targets` — and serializes them all into the response. For runs with hundreds of jobs this produces ~1.6MB responses that take 8+ seconds to serialize in Python, despite the underlying DB query completing in ~2ms. Job data is already available via `GET /runs/<name>/jobs/` which supports `?fields=` for callers to request only what they need. There is no reason for the run endpoint to duplicate this. This change removes the `get_jobs()` call from `RunController.index()` so the run endpoint returns only run-level metadata. Callers that need job data should use `/runs/<name>/jobs/` directly, optionally with `?fields=` to limit the response to needed fields. A companion change to pulpito updates `RunController.get_run()` to fetch jobs separately via `/runs/<name>/jobs/?fields=<needed fields>` rather than relying on the embedded jobs in the run response. Performance impact measured on a 300-job run: Before: 8s, 1.6MB After: <50ms, ~5KB Signed-off-by: David Galloway <david.galloway@ibm.com>
Contributor
Author
|
This caused https://tracker.ceph.com/issues/76662 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GET /runs/<name>/was callingself.run.get_jobs()which loads every job row in full — including large text/JSON columns likeoverrides,tasks,roles, andtargets— and serializes them all into the response. For runs with hundreds of jobs this produces ~1.6MB responses that take 8+ seconds to serialize in Python, despite the underlying DB query completing in ~2ms.Job data is already available via
GET /runs/<name>/jobs/which supports?fields=for callers to request only what they need. There is no reason for the run endpoint to duplicate this.This change removes the
get_jobs()call fromRunController.index()so the run endpoint returns only run-level metadata. Callers that need job data should use/runs/<name>/jobs/directly, optionally with?fields=to limit the response to needed fields.A companion change to pulpito updates
RunController.get_run()to fetch jobs separately via/runs/<name>/jobs/?fields=<needed fields>rather than relying on the embedded jobs in the run response. Performance impact measured on a 300-job run:Before: 8s, 1.6MB
After: <50ms, ~5KB