concourse / concourse/concourse
First request to .../builds extremely slower than others for job with huge build history
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 7.9k
- Forks
- 903
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
As shown in the gif (first 15sec are cut), when I go to https://ci.concourse-ci.org/teams/examples/pipelines/time-triggered/jobs/job/builds/200845
The first request to ../builds endpoint took about 17s, comparing of which to those subsequent paginated calls to the same endpoint shows it could be as 5x slower (17s vs 2s vs 3s).

For a job that has less builds(e.g. couple hundreds) the first call takes around only X0ms to X00ms and the paginated calls show no big difference.
So there are two questions here:
-
Why is the call to ../builds that slow for the job who has huge build history? Since it will fetch first 100 builds if range is not specified, which should be technically the same as a request against a job with less builds.
-
Why the paginated request to ../builds are much faster (relatively) than the first one?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the request at the reported job URL and compare the initial ../builds call with its paginated follow-up calls, recording timings for a job with a large build history. Trace the ../builds API entry point and investigate why the first request is slower. Done means the cause is identified and the initial request no longer has the reported disproportionate delay, with the behavior verified against both large and smaller histories.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100