Skip to content

controllers/runs: stop embedding full job objects in run response - #143

Closed
djgalloway wants to merge 1 commit into
mainfrom
dont-get-full-objs
Closed

controllers/runs: stop embedding full job objects in run response#143
djgalloway wants to merge 1 commit into
mainfrom
dont-get-full-objs

Conversation

@djgalloway

Copy link
Copy Markdown
Contributor

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

`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>
@djgalloway

Copy link
Copy Markdown
Contributor Author

This caused https://tracker.ceph.com/issues/76662

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant