Improve rate limits and caching for shared-IP environments#10096
Draft
santicomp2014 wants to merge 1 commit intomainfrom
Draft
Improve rate limits and caching for shared-IP environments#10096santicomp2014 wants to merge 1 commit intomainfrom
santicomp2014 wants to merge 1 commit intomainfrom
Conversation
Partners like bioRxiv/medRxiv make multiple unauthenticated search API calls per page load (2 groups x paginated at limit=50). In shared-IP environments (conferences, universities), all users share one rate limit bucket, causing 429s. Changes: - Bump general API rate limit from 4r/s burst=44 to 10r/s burst=200 - Bump badge rate limit from 1r/s burst=15 to 10r/s burst=100 - Add Cache-Control: public, max-age=60 on unauthenticated search responses and all badge responses (identical queries from shared-IP users now served from CloudFlare/browser cache) - Enable nginx JSON access logging for rate limit visibility - Increase rate limit zone memory from 1m to 2m (~16k users) Ref: product-backlog#1716 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Cache-Control: public, max-age=60on unauthenticated search responses and all badge responses. Identical queries from shared-IP users (conference WiFi, university networks) are now served from CloudFlare/browser cache.CF-Connecting-IPfor rate limit visibility (previouslyaccess_log off).docs/rate-limiting-solutions.mdwith full problem analysis, Bio's actual request patterns, and phased solution roadmap.Context
Partners like bioRxiv/medRxiv make multiple unauthenticated search API calls per page load (2 groups × paginated at
limit=50). In shared-IP environments, all users share one rate limit bucket based onCF-Connecting-IP. A heavily-annotated article (500 annotations) at a 200-person conference = ~4,000 requests from one IP, causing widespread 429s.The cache headers are the highest-leverage fix: all 4,000 requests collapse to ~20 unique queries per minute since every user makes identical paginated calls for the same article.
Ref: product-backlog#1716
Test plan
/api/searchresponses includeCache-Control: public, max-age=60/api/searchresponses do NOT include cache headers/api/badgeresponses includeCache-Control: public, max-age=60for non-blocked URIs🤖 Generated with Claude Code