---
id: gh-latency-critical-systems
name: "latency-critical-systems"
url: https://skills.yangsir.net/skill/gh-latency-critical-systems
author: affaan-m
domain: ai-system-observability-sre
tags: ["latency", "performance", "observability", "realtime", "caching"]
install_count: 4200
rating: 4.40 (120 reviews)
github: https://github.com/affaan-m/ecc/tree/main/skills/latency-critical-systems
---

# latency-critical-systems

> 此技能用于分析和优化延迟敏感系统的性能，涵盖热路径映射、指标拆分、缓存策略、背压控制等。它帮助工程师系统性地降低p95延迟、提升吞吐量，并确保实时数据新鲜度。

**Stats**: 4,200 installs · 4.4/5 (120 reviews)

## Before / After 对比

### p95延迟优化

**Before**:

在没有这个技能之前，用户手动排查延迟问题，缺乏系统性指标和热路径分析，p95延迟居高不下，达到200ms。

**After**:

此技能提供结构化的优化方法，通过指标拆分和缓存策略，将p95延迟降至20ms。

| Metric | Before | After | Change |
|---|---|---|---|
| p95延迟 | 200ms | 20ms | -90% |

## Readme

# Latency Critical Systems

Use this skill when the user cares about realtime behavior, hot paths, streaming
freshness, or execution speed. This includes HFT-like infrastructure, but the
skill is engineering-focused. It does not authorize live trading or financial
advice.

## Split The Metrics

Do not collapse everything into "fast." Track:

- p50, p95, and p99 latency;
- throughput;
- freshness age;
- queue depth;
- cache hit rate;
- provider/API response time;
- browser render time;
- correctness under load;
- failure and retry behavior.

## Map The Hot Path

Write the path from user/event to final visible state:

```text
source event -> provider API -> ingest worker -> queue -> cache -> edge route
-> client stream -> browser render -> user-visible state
```

Then measure each segment separately.

## Optimization Order

1. Remove unnecessary round trips.
2. Cache stable reads with freshness metadata.
3. Batch small calls and writes.
4. Move compute closer to the data or the user.
5. Split hot and cold paths.
6. Apply backpressure before queues grow unbounded.
7. Use streaming only when it improves freshness or user experience.
8. Add canaries for stale data, degraded providers, and bad cache state.

## Verification

Use live readbacks when a deployed surface exists:

- HTTP timing and response headers;
- provider freshness timestamp;
- queue or job state;
- edge/cache state;
- browser verification for actual UI freshness;
- logs around retries and degraded mode.

For market-data or execution-adjacent paths, also verify orderbook age, VWAP
assumptions, provider status, and kill-switch behavior before calling the path
ready.

## Guardrails

- Do not optimize latency by dropping required validation.
- Do not hide stale data behind fast cache hits.
- Do not claim millisecond behavior from client labels without measurement.
- Do not run live orders, destructive migrations, or customer-impacting deploys
  without an explicit approval gate.
- Keep secrets and private payloads out of logs and benchmark artifacts.


---
*Source: https://skills.yangsir.net/skill/gh-latency-critical-systems*
*Markdown mirror: https://skills.yangsir.net/api/skill/gh-latency-critical-systems/markdown*