Working with Distributed Debugging

1. Implementing Distributed Breakpoints

ApproachDetail
Coordinated breakpointsPause across services on matching trace id
Dynamic instrumentationLightrun, Rookout — non-stop snapshot at line
ConditionalTrigger when trace.id == X && user == Y
RiskProduction halts cause cascading timeouts

2. Understanding Remote Debugging

ToolDetail
JDWP (Java)-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
delve (Go)dlv attach <pid> --headless --listen=:2345
debugpy (Python)python -m debugpy --listen 0.0.0.0:5678 --wait-for-client
node --inspectChrome DevTools Protocol
Warning: Never expose remote debug ports to untrusted networks — full code execution.

3. Implementing Request Replaying

ToolDetail
GoReplayCapture and replay HTTP at L7
tcpcopy / tcpdumpCapture traffic
Replay bufferKafka of all requests
UseReproduce prod bugs in staging

4. Implementing Traffic Mirroring

Example: Istio mirroring

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata: { name: orders }
spec:
  hosts: [orders]
  http:
    - route:
        - destination: { host: orders, subset: v1 }
          weight: 100
      mirror: { host: orders, subset: v2 }
      mirrorPercentage: { value: 10.0 }
PropertyDetail
Fire-and-forgetMirror response discarded
No user impactTest new version on real traffic
Watch outSide effects (writes) duplicated

5. Using Distributed Profilers

ToolDetail
Pyroscope / Grafana PhlareContinuous fleet-wide profiling
ParcaeBPF-based, language-agnostic
Datadog Continuous ProfilerProduction-safe, low overhead
OutputAggregated flame graphs across pods

6. Implementing Memory Dump Analysis

StepTool
Capture (Java)jcmd <pid> GC.heap_dump /tmp/heap.hprof
AnalyzeEclipse MAT, JXRay, VisualVM
Look forDominator tree, leak suspects, retained sizes
Native (Go)go tool pprof http://svc/debug/pprof/heap

7. Understanding Heisenbug Detection

PropertyDetail
DefinitionBug disappears when observed (logging, debugger)
CausesRace conditions, timing, optimizer-elided code
DetectionThreadSanitizer, Java Flight Recorder, deterministic replay
PreventionEliminate shared mutable state, use immutability

8. Implementing Distributed Assertions

ApproachDetail
Invariant checksPeriodic background validation (totals, counts)
Cross-serviceReconciliation jobs, auditors
Soft failLog + metric, don't crash on prod

9. Implementing Testing in Production

TechniqueDetail
Feature flagsRoll out to internal users first
Shadow / mirrorRun new code on copy of traffic
CanarySmall % real users
Synthetic txMarked test orders, filtered at boundary
ChaosInjected failures (Gremlin, Litmus)

10. Using Observability for Debugging

WorkflowDetail
1. DetectAlert from SLO burn
2. TriageService map → which dep degraded?
3. DrillTrace exemplar → slow span → log line
4. ConfirmProfile flame graph, heap, queries