Token导航 LogoToken导航

Agent Skill · 开发

latency-optimization(延迟优化)

latency-optimization 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

latency-optimization 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 16,820。

总安装 466周安装 20GitHub Stars 61下载 163核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:latency-optimization(延迟优化)
来源仓库:https://github.com/melodic-software/claude-code-plugins
仓库路径:skills/latency-optimization
安装命令:
npx skills add https://github.com/melodic-software/claude-code-plugins --skill latency-optimization
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/melodic-software/claude-code-plugins --skill latency-optimization

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

latency-optimization 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态进行整理。适用于系统性能调优、响应时间改进等开发场景。通过指定仓库或 Issue 编号获取相关信息并生成报告。

安装前需确认权限范围和维护状态,注意可能涉及文件读写和命令执行。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/latency-optimization

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/melodic-software/claude-code-plugins --skill l…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

latency-optimization 怎么安装?

在终端执行 npx skills add https://github.com/melodic-software/claude-code-plugins --skill latency-opt…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

latency-optimization 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

latency-optimization 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

latency-optimization 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

latency-optimization 用的人多吗?

公开数据是累计安装 466 次,近一周安装 20 次,下载 163 次,GitHub 61 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

latency-optimization 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
latency-optimization

延迟优化 · 本页

46661操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Latency Optimization

Comprehensive guide to reducing end-to-end latency in distributed systems - from network to application to database layers.

When to Use This Skill

  • Optimizing response times for user-facing applications
  • Creating latency budgets for distributed systems
  • Implementing geographic routing strategies
  • Reducing database query latency
  • Optimizing API response times
  • Understanding and measuring latency components

Latency Fundamentals

Understanding Latency

Latency Components:

Total Latency = Network + Processing + Queue + Serialization

┌─────────────────────────────────────────────────────────────┐
│                     Request Journey                          │
│                                                              │
│  Client ──► DNS ──► TCP ──► TLS ──► Server ──► DB ──► Back  │
│                                                              │
│  Components:                                                 │
│  ├── DNS Resolution: 0-100ms (cached: 0ms)                  │
│  ├── TCP Handshake: 1 RTT (~10-200ms)                       │
│  ├── TLS Handshake: 1-2 RTT (~20-400ms)                     │
│  ├── Request Transfer: depends on size                       │
│  ├── Server Processing: application-specific                 │
│  ├── Database Query: 1-1000ms typical                       │
│  └── Response Transfer: depends on size                      │
└─────────────────────────────────────────────────────────────┘

Key Metrics:
- P50: Median latency (50th percentile)
- P95: 95th percentile (tail latency starts)
- P99: 99th percentile (important for SLOs)
- P99.9: Three nines (critical systems)

Latency Numbers Every Developer Should Know

Latency Reference (2024 estimates):

Operation                              Time
─────────────────────────────────────────────────────
L1 cache reference                     1 ns
L2 cache reference                     4 ns
Branch mispredict                      5 ns
L3 cache reference                     10 ns
Mutex lock/unlock                      25 ns
Main memory reference                  100 ns
Compress 1KB with Snappy              2,000 ns (2 μs)
SSD random read                       16,000 ns (16 μs)
Read 1 MB from memory                 50,000 ns (50 μs)
Read 1 MB from SSD                    200,000 ns (200 μs)
Round trip same datacenter            500,000 ns (500 μs)
Read 1 MB from network (1Gbps)        10,000,000 ns (10 ms)
HDD random read                       10,000,000 ns (10 ms)
Round trip US East to US West         40,000,000 ns (40 ms)
Round trip US to Europe               80,000,000 ns (80 ms)
Round trip US to Asia                 150,000,000 ns (150 ms)

Key Insights:
- Memory is 100x faster than SSD
- Same-datacenter is 80x faster than cross-continent
- Caching at any level provides huge wins

Latency Budget

Latency Budget Example (200ms target):

┌─────────────────────────────────────────────────────────────┐
│                    200ms Total Budget                        │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  ┌──────────┬──────────┬──────────┬──────────┬──────────┐  │
│  │ Network  │   Auth   │  Service │    DB    │ Response │  │
│  │   50ms   │   20ms   │   50ms   │   60ms   │   20ms   │  │
│  └──────────┴──────────┴──────────┴──────────┴──────────┘  │
│                                                              │
│  Breakdown:                                                  │
│  ├── Network (client → edge → origin): 50ms                 │
│  ├── Authentication/Authorization: 20ms                      │
│  ├── Service Processing: 50ms                               │
│  ├── Database Queries: 60ms                                 │
│  └── Response Serialization + Transfer: 20ms                │
└─────────────────────────────────────────────────────────────┘

Budget Rules:
1. Allocate budgets based on criticality
2. Leave 10-20% headroom for variance
3. Monitor P99 against budget
4. Alert when consistently over budget
5. Renegotiate budgets as system evolves

Network Latency Optimization

Geographic Routing

Geographic Routing Strategies:

1. GeoDNS Routing
   User IP ──► DNS Resolver ──► Nearest Server IP

   Pros: Simple, works everywhere
   Cons: DNS caching, IP geolocation inaccuracy

2. Anycast Routing
   Same IP advertised from multiple locations
   BGP routes to nearest (network topology)

   Pros: Instant failover, no DNS delay
   Cons: Requires BGP expertise, stateful sessions tricky

3. Load Balancer Geo-routing
   Global LB ──► Regional LB ──► Servers

   Pros: Fine-grained control, health checking
   Cons: Adds latency hop, more complex

Selection Guide:
┌──────────────────┬─────────────────────────────────────┐
│ Use Case         │ Recommended Approach                │
├──────────────────┼─────────────────────────────────────┤
│ Static content   │ Anycast CDN                         │
│ API services     │ GeoDNS + Regional deployments       │
│ Real-time apps   │ Anycast + Connection persistence    │
│ Stateful apps    │ GeoDNS with session affinity        │
└──────────────────┴─────────────────────────────────────┘

Protocol Optimization

Protocol-Level Optimizations:

1. HTTP/2 Benefits
   ├── Multiplexing (no head-of-line blocking)
   ├── Header compression (HPACK)
   ├── Server push (preemptive responses)
   └── Single connection (reduced handshakes)

   Latency Impact: 20-50% improvement typical

2. HTTP/3 (QUIC) Benefits
   ├── 0-RTT connection resumption
   ├── No TCP head-of-line blocking
   ├── Built-in encryption
   └── Connection migration (IP changes)

   Latency Impact: 10-30% over HTTP/2

3. TLS Optimization
   ├── TLS 1.3 (1-RTT handshake)
   ├── Session resumption (0-RTT)
   ├── OCSP stapling (no CA roundtrip)
   └── Certificate chain optimization

   Latency Impact: 50-200ms saved per connection

4. TCP Optimization
   ├── TCP Fast Open (TFO)
   ├── Increased initial congestion window
   ├── BBR congestion control
   └── Keep-alive for connection reuse

Connection Optimization

Connection Strategies:

1. Connection Pooling
   ┌─────────────────────────────────────────┐
   │           Connection Pool               │
   │  ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐      │
   │  │Conn1│ │Conn2│ │Conn3│ │Conn4│      │
   │  └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘      │
   └─────┼──────┼──────┼──────┼────────────┘
         │      │      │      │
      Reuse connections, avoid handshake cost

2. Preconnect/Prefetch
   <link rel="preconnect" href="https://api.example.com">
   <link rel="dns-prefetch" href="https://cdn.example.com">

   Triggers early connection establishment

3. Connection Coalescing (HTTP/2)
   Multiple domains → single connection
   (When sharing same IP and certificate)

Application Latency Optimization

Caching Strategies

Caching Layers:

┌─────────────────────────────────────────────────────────────┐
│                    Caching Hierarchy                         │
│                                                              │
│  Browser ──► CDN Edge ──► App Cache ──► DB Cache ──► DB     │
│    1ms        10ms          20ms         50ms       100ms   │
│                                                              │
│  Each layer should catch most requests before next layer    │
└─────────────────────────────────────────────────────────────┘

Cache Type Selection:
┌──────────────────┬─────────────────┬────────────────────────┐
│ Data Type        │ Cache Location  │ TTL Strategy           │
├──────────────────┼─────────────────┼────────────────────────┤
│ Static assets    │ CDN + Browser   │ Long (1 year), hashed  │
│ API responses    │ CDN + App       │ Short (seconds-mins)   │
│ Session data     │ App (Redis)     │ Session duration       │
│ DB query results │ App (local/dist)│ Varies by query        │
│ Computed results │ App             │ Based on input staleness│
└──────────────────┴─────────────────┴────────────────────────┘

Async Processing

Async Patterns for Latency:

1. Background Processing
   Request ──► Validate ──► Queue ──► Response (fast)
                             │
                             └──► Worker (async processing)

   User sees fast response, heavy work happens later

2. Parallel Requests
   Sequential:
   A(100ms) → B(100ms) → C(100ms) = 300ms

   Parallel:
   A(100ms) ─┐
   B(100ms) ─┼──► 100ms total
   C(100ms) ─┘

3. Speculative Execution
   Start likely-needed work before confirmed
   Cancel if not needed
   Risk: Wasted resources if prediction wrong

4. Read-Your-Writes with Async
   Write ──► Queue ──► Response + Local Cache Update
                         │
         User sees their write immediately
         Backend processes asynchronously

Serialization Optimization

Serialization Format Comparison:

Format        Encode    Decode    Size      Human
              Speed     Speed     (relative) Readable
─────────────────────────────────────────────────────
JSON          Fast      Fast      Large     Yes
MessagePack   V.Fast    V.Fast    Small     No
Protocol Buf  Fast      V.Fast    V.Small   No
FlatBuffers   Zero-copy V.Fast    Small     No
Avro          Fast      Fast      Small     Schema

Recommendations:
- Internal services: Protocol Buffers or MessagePack
- Public APIs: JSON (compatibility) or gRPC (performance)
- High-throughput: FlatBuffers (zero-copy)
- Schema evolution: Avro or Protocol Buffers

Optimization Tips:
1. Avoid serializing unnecessary fields
2. Use streaming for large payloads
3. Compress large responses (gzip/brotli)
4. Consider binary formats for internal traffic

Database Latency Optimization

Query Optimization

Database Latency Patterns:

1. Index Optimization
   ❌ Full table scan: O(n) - slow
   ✓ Index lookup: O(log n) - fast
   ✓ Covering index: No table lookup needed

   Monitor: Slow query logs, EXPLAIN plans

2. Query Patterns
   ❌ N+1 queries: 1 + N roundtrips
   ✓ Batch queries: 1 roundtrip
   ✓ JOINs (when appropriate): 1 roundtrip

   Example:
   ❌ for user in users: get_orders(user.id)  # N queries
   ✓ get_orders_for_users(user_ids)           # 1 query

3. Connection Management
   ├── Connection pooling (avoid connection overhead)
   ├── Prepared statements (avoid parsing overhead)
   └── Connection proximity (same region as app)

4. Read Replicas
   ┌─────────────────────────────────────────┐
   │  Writes ──► Primary                     │
   │  Reads  ──► Read Replica (lower latency)│
   └─────────────────────────────────────────┘

Database Proximity

Database Placement Strategies:

1. Co-located Database
   App and DB in same availability zone
   Latency: <1ms
   Best for: Primary workloads

2. Same-Region Replica
   Read replica in same region
   Latency: 1-5ms
   Best for: Read scaling

3. Cross-Region Replica
   Replica in user's region
   Latency: Local (~5ms) vs cross-region (~100ms)
   Best for: Global read-heavy apps

4. Globally Distributed
   Database spans regions (CockroachDB, Spanner)
   Write latency: Higher (consensus)
   Read latency: Local
   Best for: Global consistency requirements

Measurement and Monitoring

Latency Measurement

Measurement Points:

1. Client-Side (Real User Monitoring)
   └── Measures actual user experience
   └── Includes network variability
   └── Tools: Browser timing API, RUM services

2. Edge/CDN Metrics
   └── Time to first byte (TTFB)
   └── Cache hit ratio
   └── Origin fetch time

3. Server-Side (APM)
   └── Request processing time
   └── Downstream service calls
   └── Database query time
   └── Tools: OpenTelemetry, APM vendors

4. Synthetic Monitoring
   └── Consistent measurement conditions
   └── Multiple geographic locations
   └── Baseline for comparison

Distributed Tracing:
┌─────────────────────────────────────────────────────────────┐
│  Request ──► Gateway ──► Service A ──► Service B ──► DB    │
│    │           │            │            │           │      │
│    └───────────┴────────────┴────────────┴───────────┘      │
│              Trace ID links all spans together              │
│              Each span has start time + duration            │
└─────────────────────────────────────────────────────────────┘

Latency SLOs

Setting Latency SLOs:

1. Define Meaningful Metrics
   - P50: Typical experience
   - P95: Most users' worst case
   - P99: Tail latency for critical paths

2. Set Realistic Targets
   P50: 50ms    (snappy feel)
   P95: 200ms   (acceptable)
   P99: 500ms   (degraded but functional)

3. Error Budget Approach
   If target is P99 < 500ms with 99.9% SLO:
   - Budget: 0.1% of requests can exceed 500ms
   - ~43 minutes per month of violations allowed

4. Alert Thresholds
   ├── Warning: P99 > 400ms (80% of budget)
   ├── Critical: P99 > 500ms (at budget)
   └── Page: P99 > 600ms for 5 minutes (over budget)

Common Anti-Patterns

Latency Anti-Patterns:

1. "Chattiness"
   ❌ Many small requests instead of batched
   ✓ Batch requests, use GraphQL, aggregate APIs

2. "Synchronous Chains"
   ❌ A → B → C → D (sequential)
   ✓ Parallelize independent calls, use async

3. "Unbounded Queries"
   ❌ SELECT * without limits or pagination
   ✓ Always paginate, limit result sets

4. "Cache Miss Storms"
   ❌ Cache expires, all requests hit origin
   ✓ Staggered TTLs, request coalescing, warm cache

5. "Logging in Hot Path"
   ❌ Synchronous logging on every request
   ✓ Async logging, sampling for high volume

6. "Premature Serialization"
   ❌ Serialize before knowing if needed
   ✓ Lazy serialization, stream when possible

7. "Ignoring Tail Latency"
   ❌ Only monitoring averages
   ✓ Track P95, P99, P99.9 for user experience

Best Practices

Latency Optimization Best Practices:

1. Measure First
   □ Establish baseline measurements
   □ Identify bottlenecks before optimizing
   □ Use distributed tracing
   □ Monitor percentiles, not just averages

2. Optimize Strategically
   □ Start with biggest bottlenecks
   □ Apply latency budgets
   □ Consider cost vs benefit
   □ Test optimizations under load

3. Network Layer
   □ Deploy close to users (CDN, edge)
   □ Use modern protocols (HTTP/2, HTTP/3)
   □ Optimize TLS (1.3, session resumption)
   □ Connection pooling and keep-alive

4. Application Layer
   □ Cache aggressively and appropriately
   □ Parallelize independent operations
   □ Use async processing for non-critical work
   □ Optimize serialization formats

5. Data Layer
   □ Index frequently queried columns
   □ Use read replicas for read-heavy loads
   □ Connection pooling
   □ Query optimization (avoid N+1)

6. Continuous Improvement
   □ Regular latency reviews
   □ Load testing with latency assertions
   □ Automated regression detection
   □ User experience correlation

Related Skills

  • caching-strategies - Application-level caching patterns
  • multi-region-deployment - Geographic distribution
  • cdn-architecture - Edge caching and delivery
  • distributed-tracing - End-to-end latency visibility

平台分布

Codex

37.44%
按下载量换算61

Claude

28.95%
按下载量换算47

Cursor

19.33%
按下载量换算32

Gemini CLI

9.94%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills