OTLP Batch Exporter Latency Spikes Under Concurrent Load — Queue Saturation or Backoff?
0 reputation · 18 Sept 2022, 02:53 UTC
0 reputation · 18 Sept 2022, 02:53 UTC
When an application using the OpenTelemetry SDK with the OTLP exporter handles many concurrent requests, per-span export latency rises sharply compared to sequential traffic. The BatchSpanProcessor is documented to buffer spans and flush them when either maxExportBatchSize is reached or scheduleDelayMillis elapses, but under concurrency it is unclear which limit is being hit first and how the exporter's queue-full condition interacts with request threads.
The documented failure condition SpanExporter dropping spans when the queue is full is well defined, but the latency contribution of exporter retry/backoff versus queue wait time is not clearly separated in the SDK metrics. Assume a recent stable SDK release (Java 1.3x or equivalent); behavior may differ across language SDKs and collector versions, so results need verification against the specific runtime in use.
scheduleDelay waiting, queue contention, or OTLP export retries with backoff?maxQueueSize the documented way to trade latency for drop risk under concurrency?33775 reputation · 18 Sept 2022, 14:18 UTC
scheduleDelay waiting or backoff. Under high concurrency, producer threads enqueue spans faster than the single export thread can flush them, so the bounded queue approaches maxQueueSize before maxExportBatchSize is reached. Once full, enqueue calls block or spans are dropped, and that wait dominates per-span export latency. Exporter backoff normally contributes only a few milliseconds per span when the collector is healthy.maxQueueSize, plus any dropped-spans counter) alongside export duration. If queue depth tracks the latency spikes, the cause is queue wait. If queue depth stays low while export duration spikes, suspect network round-trip time or retry/backoff. These are available from SDK instrumentation without debug logging, though exact metric names vary by SDK version and metrics backend.maxExportBatchSize flushes more often, lowering per-span latency at the cost of more export requests; increasing maxQueueSize reduces drop risk but lets more spans wait in the queue, which can raise latency under saturation. Pick based on whether drops or latency hurt you more.BatchSpanProcessor runs a single worker thread that flushes when the batch reaches maxExportBatchSize or scheduleDelayMillis elapses, whichever comes first.maxQueueSize is 2048 in the Java SDK). When full, new spans are dropped rather than queued indefinitely, and contention around the full queue shows up as latency./metrics endpoint) and generate the concurrent load that reproduces the spikes.maxQueueSize confirms saturation.maxExportBatchSize (for example to 10). If latency falls while drops stay near zero, queue saturation was the primary cause.What are your current maxQueueSize and maxExportBatchSize, and what queue depth do you observe at peak load? That determines whether shrinking the batch or growing the queue is the right first change.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.