Budget the diagram exporters, on the paths production already has - #288
Open
adamjohnwright wants to merge 2 commits into
Open
adamjohnwright wants to merge 2 commits into
adamjohnwright wants to merge 2 commits into
Conversation
CURATOR-REPORT.md listed rate limiting in front of the render service as the outstanding condition before it fronts reactome.org. Doing that turned up something worth more: the Java exporters have no budget either, and they are the ones with a history. `/ContentService/exporter/*` is where crawlers exhausted Tomcat's heap and took the origin down, and today it is covered only by the site-wide 100r/s, which is sized for page assets rather than for a process drawing a diagram. So the budget goes on both, and they share a zone. It belongs to the work -- drawing a diagram -- rather than to which implementation serves it, so a caller cannot spend it twice by alternating between the Java exporter and the node renderer. 2r/s with a burst of 8, which is the node service's own queue depth (RENDER_CONCURRENCY=2, RENDER_QUEUE=8); past that it is rejecting anyway, so a deeper burst only buys a larger pile of work to throw away. Putting it on the ContentService path is also the point rather than a coincidence. Those URLs exist in production today and are what #273 moves to node, under the same names -- so the budget is already where it needs to be when the implementation changes underneath it, and `/RenderService` stops being the only protected way in. Verified rather than reasoned, against the running services: the exporter still returns a PNG through the new block, an ordinary /ContentService/ path is unaffected, the node renderer still returns a 11952x6700 PNG and an SVG, and both budgets refuse past the burst -- 8 through then 503. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The prefix version of this would have throttled reaction pages to protect
something they do not use. `/ContentService/exporter/` is not one kind of
thing: `/exporter/reaction/{id}/diagram` is a 2.9 KB JSON document served in
0.17s and it is on the critical path for every reaction page, while a render of
R-HSA-109606 on the same prefix is 454 KB, and 7 MB at full quality.
Measured both before changing it, which is the only reason the difference was
visible: I had written the prefix, tested that it refused past the burst, and
that test passed exactly as happily on the endpoint that must not be refused.
A regex location now names the four that draw -- diagram, fireworks, document,
event -- so it is tried before the /ContentService/ prefix and everything else,
the reaction JSON included, falls through unbudgeted.
Verified: fifteen rapid reaction-diagram requests all 200, the render path
refuses past the burst, and a real render returns its 454 KB PNG once the
budget refills. That last check matters because the run before it returned 503
-- my own flood had spent the budget -- and stopping there would have shipped
on a failure I had caused.
Co-Authored-By: Claude Opus 5 <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.
CURATOR-REPORT.mdlisted rate limiting in front of the render service as the outstanding condition before it fronts reactome.org. Doing that turned up something worth more.The Java exporters have no budget either — and they're the ones with a history
/ContentService/exporter/*is where crawlers exhausted Tomcat's heap and took the origin down. Today it is covered only by the site-wide 100r/s, which is sized for page assets, not for a process drawing a diagram. Verified: nolimit_reqon/ContentService/at all, and the path answers 200 on both beta and production right now.Both, sharing one zone
2r/s, burst 8 — the node service's own queue depth (
RENDER_CONCURRENCY=2,RENDER_QUEUE=8); past that it is rejecting anyway, so a deeper burst only buys a larger pile of work to throw away.They share the zone deliberately: the budget belongs to the work — drawing a diagram — rather than to which implementation serves it, so a caller cannot spend it twice by alternating between the Java exporter and the node renderer.
Why the ContentService path is the point
Those URLs exist in production today, and #273 moves those exports to node under the same names. So the budget is already where it needs to be when the implementation changes underneath it, and
/RenderServicestops being the only protected way in.Verified against the running services
/ContentService/data/database/versionis unaffectednginx -tpasses for dev, production and release.🤖 Generated with Claude Code