latency-principles

📁 ab22593k/latency-principles-skill 📅 14 days ago
4
总安装量
4
周安装量
#49202
全站排名
安装命令
npx skills add https://github.com/ab22593k/latency-principles-skill --skill latency-principles

Agent 安装分布

opencode 4
amp 2
kimi-cli 2
github-copilot 2
gemini-cli 2

Skill 文档

Latency Principles

This skill provides a systematic approach to understanding and reducing latency in software systems, based on the book “Latency” by Pekka Enberg.

Core Concepts

Latency is the time delay between a cause and its observed effect. It is a distribution, not a single number.

Quick Reference

  • Little’s Law: Concurrency = Throughput * Latency. Use to size queues and thread pools.
  • Amdahl’s Law: Speedup is limited by the serial part of the task. Use to estimate max benefit of parallelization.
  • Tail Latency: The experience of the 99th percentile users. In high-fanout systems, tail latency dominates.

For detailed definitions and laws, see references/principles.md.

Diagnosis & Optimization

When facing latency issues, follow this systematic approach:

  1. Measure First: Identify where the time is going. Don’t guess.
  2. Check the Usual Suspects: Use the checklist to rule out common issues.
  3. Model the System:
    • Is it a throughput problem (queuing)? -> Apply Little’s Law.
    • Is it a serial execution problem? -> Apply Amdahl’s Law.
    • Is it a tail latency problem (variability)? -> Check fanout and shared resource contention.

Common Sources of Latency

  • Physics: Distance (Speed of light).
  • Hardware: CPU frequency scaling, cache misses, NUMA.
  • OS: Context switching, interrupts, scheduler latency.
  • Runtime: Garbage collection pauses, JIT compilation.

When to use Reference Files