Communitygithub.com

延迟关键系统

适用于对延迟敏感的系统,如实时仪表盘、市场数据、流处理代理、执行网关、队列、缓存或类似高频交易的基础设施。当 p95 延迟或数据新鲜度至关重要时使用——实时仪表盘、市场数据、流处理代理、队列或缓存。

延迟关键系统 是什么?

此技能专门针对需要实时行为、热路径优化、流式数据新鲜度或执行速度的系统而设计,涵盖高频交易(HFT)类基础设施,但侧重于工程实践,而非授权进行实时交易或提供金融建议。它指导用户将性能指标细分为 p50/p95/p99 延迟、吞吐量、新鲜度年龄、队列深度、缓存命中率及错误重试行为等多个维度,以精确度量系统瓶颈。技能核心在于绘制从源事件到用户可见状态的完整热路径,并针对每个环节独立测量与优化。推荐的优化顺序包括消除不必要的往返、缓存稳定读取、批量处理、将计算靠近数据或用户、分离冷热路径及应用背压等。此外,通过部署后实时回读(如 HTTP 头部时间戳、提供商标记、队列状态)和特定的看门狗机制验证数据新鲜度,同时强调不因优化延迟而牺牲验证、不隐藏过期数据、不未经测量声称毫秒级行为,确保系统在保证正确性和安全性的前提下达到高性能。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/latency-critical-systems

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

延迟关键系统 是做什么的?

当用户关注实时行为、热路径、流式数据新鲜度或执行速度时,请使用此技能。这包括高频交易(HFT)类基础设施,但该技能以工程实践为重点。它不授权进行实时交易或提供金融建议。

拆分指标

不要将所有指标简单归结为“快”。请跟踪:

  • p50、p95 和 p99 延迟;
  • 吞吐量;
  • 新鲜度年龄;
  • 队列深度;
  • 缓存命中率;
  • 提供商/API 响应时间;
  • 浏览器渲染时间;
  • 负载下的正确性;
  • 失败和重试行为。

绘制热路径

编写从用户/事件到最终可见状态的路径:

源事件 -> 提供商 API -> 摄取工作器 -> 队列 -> 缓存 -> 边缘路由
-> 客户端流 -> 浏览器渲染 -> 用户可见状态

然后分别测量每个环节。

优化顺序

  1. 消除不必要的往返。
  2. 缓存稳定读取并携带新鲜度元数据。
  3. 批量处理小调用和写入。
  4. 将计算移动到更接近数据或用户的位置。
  5. 分离热路径和冷路径。
  6. 在队列无限增长之前应用背压。
  7. 仅当提升新鲜度或用户体验时才使用流式传输。
  8. 为过期数据、降级提供商和不良缓存状态添加看门狗。

验证

当存在已部署的表面时,使用实时回读:

  • HTTP 计时和响应头;
  • 提供商新鲜度时间戳;
  • 队列或作业状态;
  • 边缘/缓存状态;
  • 浏览器验证实际 UI 新鲜度;
  • 围绕重试和降级模式的日志。

对于市场数据或执行相关的路径,在标记路径就绪之前,还需验证订单簿年龄、VWAP 假设、提供商状态和终止开关行为。

护栏

  • 不要为了优化延迟而放弃必要的验证。
  • 不要用快速缓存命中来掩盖过期数据。
  • 未经测量,不要声称客户端标签具有毫秒级行为。
  • 没有明确的审批关口,不要运行实时订单、破坏性迁移或影响客户的部署。
  • 不要将密钥和私有有效载荷记录在日志和基准测试产物中。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能