-
-
Notifications
You must be signed in to change notification settings - Fork 144
FEAT: Resource Utilization Checks before ingestion. #1351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT: Resource Utilization Checks before ingestion. #1351
Conversation
Caution Review failedThe pull request is closed. WalkthroughA new middleware for monitoring system resource utilization has been introduced and integrated into the HTTP server's middleware stack. This middleware checks CPU and memory usage on each request, rejecting requests with a 503 error if usage exceeds set thresholds. Module declarations were updated to include the new functionality. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ActixServer
participant ResourceCheckMiddleware
participant NextHandler
Client->>ActixServer: HTTP Request
ActixServer->>ResourceCheckMiddleware: Pass request
ResourceCheckMiddleware->>ResourceCheckMiddleware: Check CPU & Memory usage
alt Usage exceeds threshold
ResourceCheckMiddleware-->>Client: 503 Service Unavailable
else Usage within limits
ResourceCheckMiddleware->>NextHandler: Forward request
NextHandler-->>Client: Response
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
Resource Utilization Thresholds: Sending 503 response if CPU/Memory thresholds exceed.
Description
This PR enhances our ingestion pipeline by implementing an overload protection mechanism during peak usage. Specifically, when CPU or memory utilization crosses predefined thresholds, the system will proactively reject further ingestion requests with an HTTP 503 (Service Unavailable) status. This prevents uncontrolled resource consumption and cascading failures.
File Changes
resource_check.rs
: This is a middleware which checks resource utilization before every ingestion request.modal/mod.rs
: To wrap the above middleware.http/mod.rs
: To expose said middleware.Summary by CodeRabbit