perf: cache slow list APIs for lower TTFB#52
Open
thowar2 wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for cipherscan ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for cipherscan-crosslink ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
thowar2
marked this pull request as ready for review
July 23, 2026 16:46
Collaborator
Author
|
@Kenbak this is a database performance optimization for page loading. It may be too heavy for deployment at this time since its touching database logic. |
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.
Why
The frontend TTFB deployment is live and warm Netlify/ISR traffic is already fast, but production measurements isolate query-bearing archive pages as the remaining bottleneck. Representative direct API TTFB was about 0.6s for block/transaction lists and 3.4–3.6s for shielded history; the historical shielded archive tail had roughly 1.25s median HTML TTFB. Many page-number URLs collapse to the same cursor/filter API identity, so a shared list-response cache is the highest-leverage next step.
What changed
X-CipherScan-Cache: HIT|MISS|STALEplusServer-Timingon covered API responses and expose those headers through CORS.Safety and rollout
The feature defaults off. Production enables it with
API_LIST_CACHE_ENABLED=1inserver/api/.envonly after confirming Redis is private and persistent. Setting the flag back to0and restarting the API is the rollback. This PR does not deploy or alter the frontend cache policy.After the backend deploy, verify paired public API requests show
MISSthenHITorSTALEwith identical JSON, rerun the archive-aware HTML TTFB probe, then start a fresh full-population Ahrefs crawl. Next does not forward the upstream API cache header, so API and HTML evidence remain separate.Validation
git diff --checkpassed.