Rate-limit expensive RPCs to prevent resource exhaustion

Open
#1,273 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
rust

Research direction

Start by tracing the named RPC entry points: KMS key issuance/SignCert, Gateway RegisterCvm, and Verify. Define how anonymous, authenticated, shared-resource, and replica-spread requests should be limited, then validate floods and expensive invalid requests against early rejection, service preservation, retry guidance, bounded state, and exposed counters.

Written by the indexing model from the issue text.

Description

Problem

Repeated calls to expensive RPCs—such as KMS key issuance / SignCert, Gateway RegisterCvm, and Verify—can exhaust CPU, disk, subprocess, or external-service resources and degrade service for other users.

Abuse can come from unauthenticated callers, invalid requests that are expensive to reject, or authenticated clients making otherwise valid requests. Authentication and concurrency limits alone do not bound sustained resource consumption.

Proposed direction

Introduce low-overhead, server-side rate limiting for expensive RPC paths:

  • Configurable token buckets with sustained-rate and burst limits.
  • A coarse limit before expensive authentication, attestation verification, or request processing.
  • Additional per-client limits using verified instance/app identity where available. For anonymous callers, define an appropriate source-based policy; never trust arbitrary identity headers.
  • Shared service/resource budgets to contain aggregate load, including requests spread across identities or endpoints.
  • Reject excess requests early with a distinguishable rate-limit error and retry guidance.
  • Bound limiter state and cleanup cost. Start process-local and document how limits behave across replicas.

Limits should accommodate normal boot, registration refresh, and certificate renewal bursts.

Validation

Test floods from anonymous callers, expensive invalid requests, and authenticated clients. Verify that limits bound accepted request rates, reject excess work early, and preserve service for unrelated clients. Expose rate-limit counters for tuning.

Related: #1258, #1259. Separate from concurrency/admission control in #1096.

Dominant language
Rust
Stars
546
Forks
96
Avg merge
19h 22m
Merged PRs (30d)
109

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Dstack-TEE/dstack

All issues in Dstack-TEE/dstack

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.