Skip to main content

implement-a-rate-limiter

Implement a rate limiter with fair identity, atomic accounting, burst policy, distributed consistency, failure behavior, response semantics, and observability. Use when resource use or abuse must be bounded.

소스 정보

저장소
protosphinx/sphinxstack
최근 소스 활동
2026년 7월 29일 13:55
감지된 SKILL.md 언어
영어
스타
3
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
2 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
implement-a-rate-limiter
category
code
description
Implement a rate limiter with fair identity, atomic accounting, burst policy, distributed consistency, failure behavior, response semantics, and observability. Use when resource use or abuse must be bounded.
# implement-a-rate-limiter Limit the costly action at the identity and scope that create the risk. ## When to use - Use for APIs, authentication, messaging, jobs, expensive queries, or shared resources. - Do not use an unstable address as the sole identity where it harms shared or displaced users. ## Preconditions - Define protected resource, actors, identities, costs, limits, burst, windows, regions, exceptions, and failure tolerance. ## Procedure 1. Choose subject, route, tenant, credential, device, or composite keys with privacy review. 2. Select fixed, sliding, token, leaky, or concurrency control from desired semantics. 3. Make accounting atomic and define distributed consistency plus clock behavior. 4. Weight different operations by verified cost where needed. 5. Return documented status, retry timing, remaining capacity where safe, and accessible guidance. 6. Define fail-open, fail-closed, degraded, allowlist, and emergency authority. 7. Prevent bypass through key rotation, fan-out, case, path, or regional routing. 8. Test boundaries, bursts, concurrency, outage, fairness, recovery, and abuse. ## Failure plan - Enter a bounded degraded mode when the limiter store fails, with explicit resource protection and monitoring. ## Worked example A login limiter combines account and network risk, avoids punishing an entire campus, and uses stricter recovery controls after repeated failures. ## Done - A rate-limiter implementation records identities, algorithm, atomic state, limits, responses, failure mode, exceptions, and telemetry - Boundary, concurrency, clock, region, bypass, outage, fairness, privacy, and recovery tests verify behavior
GitHub에서 보기