[WIP] Manage Porter threads and backpressure better#106
Draft
derekpierre wants to merge 5 commits intonucypher:developmentfrom
Draft
[WIP] Manage Porter threads and backpressure better#106derekpierre wants to merge 5 commits intonucypher:developmentfrom
derekpierre wants to merge 5 commits intonucypher:developmentfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds request-level backpressure to Porter’s Flask/Hendrix web controller by limiting concurrent in-flight requests, while exempting health-check style endpoints.
Changes:
- Introduces a global in-flight request semaphore with an acquire timeout and 429 on overload.
- Exempts
/get_ursulasand/bucket_samplingfrom the in-flight cap. - Lowers Hendrix deployer default max threadpool size.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| porter/main.py | Defines the non-capped health-check paths and passes them into the WebController. |
| porter/controllers.py | Implements the in-flight semaphore gating in Flask request hooks and adjusts deployer defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #106 +/- ##
===============================================
+ Coverage 90.91% 91.19% +0.27%
===============================================
Files 18 18
Lines 969 999 +30
===============================================
+ Hits 881 911 +30
Misses 88 88 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…h multiple nodes in a cohort; we don't limit /get_ursulas and /bucket_sampling since those can be used for health checks. Use a global concurrent requests semaphore for absorbing some back-pressure from too many requests; if the semaphore can't be acquired after a timeout then return 429. Reduce Hendrix max threads since it can overwhelm the server.
8244738 to
40224ed
Compare
7 tasks
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.
Type of PR:
Required reviews:
What this does:
Depends on changes in [WIP] Additional safety valves when using
NetworkRequestClientfor making threshold requests nucypher#3722Use a global concurrent requests semaphore for absorbing some back-pressure from too many requests; if the semaphore can't be acquired after a timeout then return 429. Reduce Hendrix max threads since it can overwhelm the server.
Configure max worker threads used per request, and allow overwriting via env variable
Issues fixed/closed:
Why it's needed:
Notes for reviewers: