惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
O
OpenAI News
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Webroot Blog
Webroot Blog
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
N
News | PayPal Newsroom
H
Hacker News: Front Page
博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The Last Watchdog
The Last Watchdog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Heimdal Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Schneier on Security
宝玉的分享
宝玉的分享
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
Microsoft Security Blog
Microsoft Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
GbyAI
GbyAI
Cloudbric
Cloudbric
TaoSecurity Blog
TaoSecurity Blog
人人都是产品经理
人人都是产品经理
P
Palo Alto Networks Blog
M
MIT News - Artificial intelligence
G
GRAHAM CLULEY
C
Check Point Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
T
Troy Hunt's Blog
L
Lohrmann on Cybersecurity
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
量子位
博客园 - 聂微东
S
Securelist
博客园 - 三生石上(FineUI控件)
F
Full Disclosure
G
Google Developers Blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
AI
AI
PCI Perspectives
PCI Perspectives

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
System Design - 5.Latency vs Throughput Latency vs Throughput: Why "Average Response Time" Is the Biggest Lie in Engineering
Rajkiran · 2026-05-31 · via DEV Community

The Misleading Dashboard
Imagine you're an engineer at an e-commerce company. Your monitoring dashboard shows:

*Average API response time: 120ms *

Looks healthy. You go home. Sleep well.

But tomorrow morning, 1% of your users are filing complaints. Their checkouts are taking 8–10 seconds. They're abandoning their carts. You're losing thousands of dollars per hour.

Your average is fine. Your tail latency is catastrophic.

This is one of the most common and costly blind spots in engineering. And it starts with a fundamental misunderstanding of what latency and throughput actually mean — and how to measure them properly.

Latency: What It Really Is
_Latency _is the time it takes for a single request to travel from start to finish.

User sends request → [time passes] → User receives response

|←─────────── Latency ────────────→|

Simple enough. But here's where engineers go wrong: they think "latency" means "average latency."

Average latency hides the suffering of your slowest users.

If you have 100 requests and 99 take 100ms while 1 takes 9 seconds:

Average = (99 × 100ms + 1 × 9000ms) / 100 = 188ms

Your average looks fine (188ms). But 1 in every 100 users just waited 9 seconds. That's your tail.

Tail Latency: The Metric That Actually Matters
Percentile latency (p50, p90, p99, p999) tells you the experience of every percentile of your users — not just the average.

p50 (median): 100ms → half your users are faster, half slower

p90: 200ms → 90% of users faster than this, 10% slower

p99: 800ms → 99% faster, 1% slower

p999: 5000ms → 99.9% faster, 0.1% slower

p99 is the standard production metric. It tells you what the 1-in-100 user experiences. At 1 million requests per day, p99 = 10,000 users having a bad experience every day.

p999 matters for financial systems and health-critical applications — the 1-in-1000 case. At high volume, even 0.1% is a lot of users.

Google's internal rule: They optimize for p99, not average. Because the users who experience high latency are disproportionately likely to be your most active users — they're making more requests, so they hit the tail more often.

Why Tail Latency Is Hard to Kill
The "slow server" problem:

In a distributed system, a single user request often fans out to multiple backend services:

User Request

├── Service A (50ms)

├── Service B (80ms)

├── Service C (200ms ← occasional GC pause)

└── Service D (60ms)

Total latency = max(50, 80, 200, 60) = 200ms (not the sum, the max)

The slowest dependency determines total latency. This is called the "long tail of latency in parallel calls" — and it means that even if each service has a 1% chance of being slow, a request that touches 100 services has a 63% chance of hitting at least one slow one.

P(at least one slow service) = 1 - (1 - 0.01)^100 ≈ 63%

The hedged request pattern (Google's solution): Send the same request to two servers simultaneously. Use whichever responds first. Cancel the other.

Cost: 2x backend load for the hedged requests. Benefit: p99 latency drops dramatically — you're no longer at the mercy of the slow tail.

Throughput: The Other Half of the Equation
Throughput is how many requests your system handles per unit of time.

Throughput = requests per second (RPS) or queries per second (QPS)

If latency is about speed for one user, throughput is about capacity for all users simultaneously.

A restaurant analogy:

-Latency = how long your meal takes from order to table
-Throughput = how many meals the restaurant serves per hour

A fine dining restaurant might have 45-minute latency (your meal takes 45 min) but low throughput (serves 30 meals/hour). A fast food restaurant has 3-minute latency and massive throughput (600 meals/hour).

Neither is better — it depends what you're optimizing for.

The Latency-Throughput Trade-off
Here's the non-obvious insight: latency and throughput often trade off against each other.

Scenario: Database writes

Option A: Write synchronously to all 3 replicas before responding

→ Latency: High (wait for all 3)

→ Throughput: Low (can only process next request after all 3 ack)

Option B: Write to 1 replica, acknowledge immediately, replicate async

→ Latency: Low (respond immediately)

→ Throughput: High (pipeline many requests)

→ Trade-off: Brief inconsistency window

_Batching increases throughput at the cost of latency:
_

Without batching:

Request 1 → DB write (5ms) → respond

Request 2 → DB write (5ms) → respond

Throughput: 200 req/sec

With batching (wait 10ms, write 50 requests together):

50 requests → 1 DB write (8ms) → respond to all 50

Throughput: ~6,000 req/sec

Latency: +10ms wait time (worse for individual requests)

Kafka uses batching aggressively. Producers batch messages for a few milliseconds before sending. This is why Kafka's throughput is extraordinary — but individual message latency is slightly higher than a system that writes one message at a time.

Amdahl's Law: The Ceiling on Parallelism
Here's a fundamental truth about performance optimization that most engineers learn too late:

Amdahl's Law: The maximum speedup from parallelizing a program is limited by its sequential portions.

Speedup = 1 / (S + (1 - S) / N)

Where:

S = fraction of the program that must run sequentially (can't be parallelized)

N = number of parallel processors

Example:

Your task: 80% can be parallelized, 20% must be sequential (S = 0.20)

With 2 processors: Speedup = 1 / (0.2 + 0.8/2) = 1 / 0.6 = 1.67×

With 4 processors: Speedup = 1 / (0.2 + 0.8/4) = 1 / 0.4 = 2.5×

With 8 processors: Speedup = 1 / (0.2 + 0.8/8) = 1 / 0.3 = 3.33×

With ∞ processors: Speedup = 1 / 0.2 = 5× (the ceiling!)

Even with infinite servers, you can only ever get 5× speedup if 20% of your work is sequential.

What this means for system design:

Adding more servers hits diminishing returns quickly
The bottleneck is always your sequential component — usually the database, a single queue consumer, or a global lock
Optimize the sequential bottleneck first before adding horizontal capacity

Real example: Uber's geospatial matching — finding nearby drivers — must happen in a single, ordered process (otherwise two requests might match the same driver). This sequential requirement is why Uber invests so heavily in optimizing that single component rather than just adding more servers.

How Google Search Achieves Sub-100ms Latency
Google Search processes your query in under 100ms. Globally. Against petabytes of indexed data. This is arguably the most impressive latency achievement in software history.

How? A combination of several techniques:

1. Inverted index pre-computation Google doesn't search the web when you search. It searches a pre-built index that maps every word to the pages containing it. The real work happens before your query.

2. Massive parallelism with result merging Your query fans out to thousands of servers simultaneously, each searching a slice of the index. Results are merged. The total latency is the max of all parallel calls plus merge time — not the sum.

3. Proximity and caching Your request goes to a data center close to you. Popular queries are cached. Cache hits return in single-digit milliseconds.

4. Tail latency management Slow-responding servers are detected, and results are assembled without them. Better to return a slightly incomplete result fast than a complete result slowly.

The lesson for your system designs: Latency at scale requires pre-computation (don't compute at query time), parallelism (fan out, then merge), proximity (serve from nearby), and graceful degradation (handle slow components without blocking).

AWS Lambda: High Throughput, Variable Latency
AWS Lambda is the canonical example of a high-throughput, latency-variable system.

Cold start problem: When a Lambda function hasn't been invoked recently, AWS needs to provision a container, load your code, and initialize your runtime. This cold start adds 100ms–2 seconds of latency.

For a function that normally runs in 50ms, a cold start means 20-40x higher latency for that first request.

How teams handle it:
_
Provisioned concurrency_
— keep a pool of warm containers always ready (eliminates cold starts, increases cost)
Ping/keep-alive — schedule a heartbeat invocation every few minutes to keep containers warm
_Minimize package size _— smaller packages = faster cold starts

This is the throughput vs latency trade-off made explicit: Lambda gives you infinite throughput (scale to millions of requests/sec) at the cost of variable, sometimes high latency.

Interview Scenario: "How Do You Reduce p99 Latency?"
This is a real senior engineer interview question. Here's a structured answer:

Step 1: Identify where latency is coming from

Use distributed tracing (Jaeger, Zipkin) to find which service

contributes most to p99 latency. It's almost never where you expect.

Step 2: Check for the usual suspects

  • Database: missing index? N+1 query problem? Lock contention?

  • Network: are you making sequential calls that could be parallel?

  • GC pauses: Java/Go garbage collection causing periodic freezes?

  • Thread pool exhaustion: requests queuing waiting for threads?

  • External API calls: are you blocking on a slow third-party service?

Step 3: Apply targeted fixes

  • Add caching in front of slow operations

  • Parallelize sequential calls where possible

  • Use async/non-blocking I/O to avoid thread exhaustion

  • Implement circuit breakers for slow external dependencies

  • Consider hedged requests for the most latency-sensitive paths

Step 4: Monitor the right metric

Fix for p99, not for average.

After your fix, check p99, p95, p90 — not just average latency.

Key Takeaways
Latency = time for one request. Throughput = requests handled per second. Both matter, but they measure different things.
Average latency is misleading. p99 and p999 tell you what your worst-served users actually experience.
At scale, tail latency compounds — a request touching many services is likely to hit at least one slow one.
Latency and throughput trade off. Batching improves throughput but increases individual request latency.
Amdahl's Law says you can't parallelize your way past the sequential bottleneck. Find it and fix it first.
Hedged requests (send to two servers, use the faster) are Google's primary p99 reduction technique.
Always trace before optimizing — latency problems are almost never where you assume.