Skip to content
tezvyn:

Diagnosing latency with distributed tracing

Source: interviewHardHow cards are made

Summary

using traces to localize a bottleneck.

Key points

follow the trace ID across spans, compare per-span durations to find the slow hop, distinguish service time from network and queueing.

What's really being asked

Whether you can move from a vague latency complaint to the exact slow hop using traces, and whether you know the one thing the mesh cannot do alone: propagate context.

The full answer

The mesh sidecars automatically generate a span for each inbound and outbound hop and attach timing, status and identity. To stitch those spans into a single end-to-end trace, the application must forward the tracing headers, such as the B3 or W3C traceparent headers, from inbound to outbound requests; the mesh injects them but cannot carry them across an app's internal call boundary. With that in place, you capture a representative slow request, open its trace in the tracing UI, and read the waterfall. You look for the span with the largest self time, distinguishing time spent inside a service from time waiting on a downstream dependency, and from network or queueing delay visible as gaps between spans. Aggregate per-service latency dashboards point you at suspects, but the individual trace localizes the bottleneck.

The mistakes people make

Claiming the mesh produces complete traces with zero application involvement; without header propagation traces fragment into disconnected single-hop spans. Relying only on average or p99 dashboards, which show that something is slow but not where. Confusing logs and metrics with tracing; each answers a different question.

What usually comes next

Why does sampling matter and how do you ensure the slow request was sampled? What headers must the app propagate and how? How do you separate genuine service compute time from lock contention or GC pauses that a trace span alone may not explain? How do metrics and traces complement each other?

A concrete example

The checkout call spans gateway, cart, pricing and inventory. The trace waterfall shows gateway, cart and inventory each finishing in tens of milliseconds, but the pricing span has 800 milliseconds of self time with no child calls, pointing at slow computation inside pricing rather than a network or downstream issue. You confirm by correlating that trace's timestamp with pricing's CPU and GC metrics.

Interview question

Your mesh sidecars emit spans automatically, yet your traces show only disconnected single-hop fragments. What is the most likely cause?

  • a.The applications are not propagating the tracing headers between inbound and outbound callsCorrect
  • b.Distributed tracing requires NetworkPolicies to be disabled
  • c.Sidecars cannot generate spans without a dedicated tracing pod per service
  • d.The control plane is down, so no spans are recorded
Why?

Sidecars generate spans and inject trace headers, but the app must forward those headers across its own call boundary to link spans into one trace. Without propagation, traces fragment into single-hop pieces.

Just read this? Test yourself on what you have been reading.

Read the original → istio.io

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles