TT-17746: Improve resolver performance#154
Conversation
…ecting and doc resolution
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA Vlad Zabolotnyi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
This PR introduces significant performance improvements to the Benchmarks included in the PR description show a reduction in processing time from several minutes to a few seconds for a document with two million unresolved references, highlighting the magnitude of the improvement. Files Changed AnalysisThe changes are well-encapsulated within the
Architecture & Impact Assessment
Resolution Flow Comparisongraph TD
subgraph Old Sequential Flow
A[ResolveAll starts] --> B{Walk JSON};
B -- Found ref --> C[Fetch from Backend];
C --> D{Substitute Value};
D --> B;
B -- Found same ref again --> E[Fetch from Backend AGAIN];
E --> F{Substitute Value};
F --> B;
B -- Done --> G[Return resolved JSON];
end
subgraph New Concurrent Flow
H[ResolveAll starts] --> I[1. Create Memo Cache];
I --> J[2. Collect all *unique* refs];
J --> K[3. Prefetch all refs concurrently];
K --> L[4. Populate Memo Cache];
L --> M{5. Walk JSON};
M -- Found ref --> N[Read from Memo];
N --> O{Substitute Value};
O --> M;
M -- Done --> P[Return resolved JSON];
end
Scope Discovery & Context ExpansionThe changes are localized to the The performance gain directly translates to faster service availability and more efficient configuration updates. To fully map the impact, a cross-repository search for usages of Metadata
Powered by Visor from Probelabs Last updated: 2026-07-13T16:22:27.798Z | Triggered by: pr_updated | Commit: 878c945 💡 TIP: You can chat with Visor using |
Security Issues (1)
Security Issues (1)
Performance Issues (1)
Powered by Visor from Probelabs Last updated: 2026-07-13T16:22:15.745Z | Triggered by: pr_updated | Commit: 878c945 💡 TIP: You can chat with Visor using |
|
|
|
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |



Ticket: https://tyktech.atlassian.net/browse/TT-17746
Description
ResolveAll can be called with a huge amount of data and unresolved refs. If cache is disabled it will take a huge amount of time. To improve resolving large amount of data at a single call we will add dedup cache. Its basically one more in-memory cache that lives only for a single request/call. Also we've reworked resolving processing and now its concurrent.
Added 10000 APIs with 50 vault and 50 consul custom stores. Each vault store managing different path(extend gateway gating with single path). Each API contains 100 unresolved kv:// and $kv{} references. When gateway is started, the process should resolve 1_000_000 unresolved references.
With cache turned ON there is no meaningful difference in performance. So its super visible for cases when its disabled.
Benchmarks:
Original logic
NO CACHE
Given 10000 APIs with 50 vault and 50 consul custom stores
With each api has 20 unresolved references(low value to not waiting for 5 min 😄 )
200_000 unresolved references per hot-reload
Took 2min45sec to start the gateway
================================================
New logic
NO CACHE
Given 10000 APIs with 50 vault and 50 consul custom stores
With each api has 200 unresolved references
2_000_000 unresolved references per hot-reload
Took ~2.5 sec
Screen.Recording.2026-07-13.at.18.07.16.mov
Types of changes
Checklist
master!masterbranch (left side). Also, it would be best if you started your change off our latestmaster.go mod tidy && go mod vendorgofmt -s -w .go vet ./...