KEMBAR78
Optimize BatchSpanProcessor · Issue #7140 · open-telemetry/opentelemetry-java · GitHub
Skip to content

Optimize BatchSpanProcessor #7140

@raipc

Description

@raipc

Describe the bug
Currently, worker.addSpan is slow and blocks writing threads on huge load

Steps to reproduce
Increase span queue size, generate huge load so that span queue is close to its limit

What did you expect to see?
No or little time spent in BatchSpanProcessor.onEnd in profile

What did you see instead?
2% of total time spent in BatchSpanProcessor.onEnd, which is just adding spans to a queue

What version and what artifacts are you using?
Artifacts: opentelemetry-api, opentelemetry-sdk, BatchSpanProcessor
Version: v1.3.0

Environment
Compiler: Temurin 23.0.1
OS: Ubuntu 24.04

Proposed changes

  1. Calculate queue size externally
  2. Allow concurrent writes of batches to keep on pace
  3. Allow to configure worker, e.g. use actor instead of background thread

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions