latency-critical-systems
affaan-m/ecc
Optimize realtime systems for latency, freshness, and throughput with structured measurement and safe deployment.
What is latency-critical-systems?
This skill guides optimization of latency-sensitive systems—dashboards, market data, streaming agents, execution gateways, and caches—where p95 latency and data freshness matter. Use it to measure hot paths, eliminate bottlenecks, and verify behavior under load without sacrificing correctness or safety.
- Track p50, p95, p99 latency, throughput, freshness age, queue depth, and cache hit rate separately
- Map the full hot path from source event through APIs, workers, queues, caches, and client render to user-visible state
- Apply optimization order: remove round trips, cache with freshness metadata, batch calls, move compute closer to data or user, split hot/cold paths, apply backpressure, use streaming judiciously
- Verify deployed behavior via HTTP timing, provider timestamps, queue state, edge/cache state, and browser verification
- Enforce guardrails: no validation shortcuts, no hidden stale data, no unverified millisecond claims, explicit approval for live orders or customer-impacting deploys
How to install latency-critical-systems
npx skills add null --skill latency-critical-systemsHow to use latency-critical-systems
- 1.Define your hot path: trace the journey from source event (user action, market tick, order) through all intermediaries (APIs, workers, queues, caches, edge, browser) to final visible state
- 2.Instrument each segment: measure p50, p95, p99 latency, throughput, freshness age, queue depth, cache hit rate, and provider response time separately using logs, metrics, or APM tools
- 3.Identify bottlenecks by comparing segment latencies and freshness; prioritize the slowest or stalest link
- 4.Apply optimizations in order: eliminate unnecessary round trips, add caching with freshness metadata, batch small calls, move compute closer to data or user, split hot and cold paths, apply backpressure to queues, use streaming only if it improves freshness or UX
- 5.Verify deployed changes using live readbacks: HTTP timing headers, provider timestamps, queue state, edge/cache state, and browser verification for actual UI freshness
- 6.For market-data or execution paths, also verify orderbook age, VWAP assumptions, provider status, and kill-switch behavior before marking ready
- 7.Document guardrails: ensure no validation is skipped for speed, stale data is never hidden, latency claims are measured not assumed, and live orders or customer-impacting deploys require explicit approval
Use cases
- Optimizing a realtime stock ticker or market-data dashboard for sub-100ms p95 latency and fresh orderbook state
- Reducing queue depth and improving freshness in a streaming event-processing pipeline for fraud detection or alerts
- Tuning cache hit rates and edge routing for a multi-region dashboard serving thousands of concurrent users
- Measuring and improving end-to-end latency in an execution gateway from order submission to confirmation
- Diagnosing and fixing stale-data bugs in a high-frequency cache layer by adding freshness canaries and provider status checks
- Backend engineers building realtime systems, dashboards, or streaming infrastructure
- Platform teams optimizing execution gateways, queues, or market-data pipelines
- DevOps and SRE roles responsible for latency SLOs and freshness guarantees
- Full-stack engineers tuning end-to-end latency from API to browser render
latency-critical-systems FAQ
Track both. p50 tells you typical behavior; p95 tells you what users experience at scale. Optimize p95 and p99 first—they drive user perception and SLO breaches.
Cache stable reads with freshness metadata. Use streaming only if it improves freshness or user experience compared to polling or cache refresh. Streaming adds complexity; measure the benefit first.
Use provider timestamps, queue state snapshots, and cache metadata to simulate staleness. Once deployed, verify with live readbacks: HTTP headers, provider status, and browser verification for actual UI freshness.
No. Validation is a guardrail. If validation is slow, optimize it (batch, move closer to data, cache results) but do not drop it.
Measure latency from order submission to confirmation, provider response time, queue depth, retry behavior, and kill-switch latency. Verify orderbook age and VWAP assumptions before going live.
Full instructions (SKILL.md)
Source of truth, from affaan-m/ecc.
name: latency-critical-systems description: Use for latency-sensitive systems such as realtime dashboards, market data, streaming agents, execution gateways, queues, caches, or HFT-like infrastructure where freshness and p95 latency matter. metadata: origin: ECC tools: Read, Write, Edit, Bash, Grep, Glob
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:
source event -> provider API -> ingest worker -> queue -> cache -> edge route
-> client stream -> browser render -> user-visible state
Then measure each segment separately.
Optimization Order
- Remove unnecessary round trips.
- Cache stable reads with freshness metadata.
- Batch small calls and writes.
- Move compute closer to the data or the user.
- Split hot and cold paths.
- Apply backpressure before queues grow unbounded.
- Use streaming only when it improves freshness or user experience.
- 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.
Related skills
More from affaan-m/ecc and the wider catalog.
lead-intelligence
AI-powered lead discovery, scoring, and personalized outreach across email, LinkedIn, and X.
liquid-glass-design
iOS 26 Liquid Glass design system with dynamic blur, reflection, and interactive morphing for SwiftUI, UIKit, and WidgetKit.
literature-review
Systematic literature-review workflow for academic, biomedical, and technical research with search planning, screening, synthesis, and citation verification.
living-docs-governance
Agent skill from affaan-m/ecc.
llm-trading-agent-security
Security patterns for autonomous trading agents: prompt injection defense, spend limits, pre-send simulation, circuit breakers, and key isolation.
logistics-exception-management
Expert guidance for resolving freight exceptions, damage claims, and carrier disputes across all shipping modes.