Repository navigation
perf(platform): read an organization's default credentials once per request - #4595
Merged
Merged
Conversation
yannickmonney
added this pull request to the merge queue
Oct 9, 2026
yannickmonney
removed this pull request from the merge queue due to the queue being cleared
Oct 9, 2026
yannickmonney
force-pushed
the
perf/credential-reads-once
branch
from
October 9, 2026 04:28
7069daf to
8d1dcd3
Compare
yannickmonney
enabled auto-merge
October 9, 2026 04:30
…equest The composer's model listing, which every app boot fetches, looked up each shipped provider's default credential one by one: 14 reads a call, 0.63 credential reads per request across a 3,000-user mixed run. The shim handlers live for one request or turn; they now answer every provider of an organization from one read and drop it when a broker write runs in the same shim. 14 reads a listing become 3.
yannickmonney
force-pushed
the
perf/credential-reads-once
branch
from
October 9, 2026 04:45
8d1dcd3 to
e183bc3
Compare
This was referenced Oct 9, 2026
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.
What
GET /api/app/chat/composer/modelsruns on every app boot. It looked up each provider's default credential separately: the transcription check walks every OpenAI-format provider, and the credential resolver asks again for each one with a key. That came to 14 credential reads per listing.In the load harness's 3,000-user mixed run (#4589),
provider_credentialswas the fourth most frequent statement, at 0.63 reads per HTTP request. The composer listing's p50 under that load was 2.4 s.credentialShimHandlersis built for one shim, so it lives for one request or one turn. It now answers everygetDefaultCredentialInternalfor an organization from one read (is_default AND status = 'active', same rows as before). It drops that read whenever a broker write (selectBrokerAccount,recordBrokerFailure) runs in the same shim, so a retry after a failed account sees the rows as they are now. A failed read is not remembered. Nothing is cached across requests.Evidence
Main against this branch, same backend configuration and data, 20 sequential listings after a warm-up, run twice each:
Testing
service.default-reads.test.ts(4 tests) checks that:null;