You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Span reporter uses UUID.randomUUID() to generate the span id, which internally uses SecureRandom and is very slow.
Whereas tracer server like Jaeger uses Java6CompatibleThreadLocalRandom.current().nextLong() which is 10 times faster with no contention(one thread) and around 50 to 100 times faster with contention (multilple threads) compared to UUID.randomUUID().
Instead of creating its own span id, span reporter can get the span id from the tracing implementation i.e. wspan.context().toSpanId(). Could span-reporter use random instead of uuid or something like below??
This is a picture profiled on my production server. The cost comes from the following areas:
SpanBuilderR.start():
UUID.randomUUID(): 17%
Adding the custom id to baggageItems: 13%
UUID.toString(): 2%
SpanBuilderR.addReference: when we set a span as a child of another span we need to search the baggage items for the custom span id: 2%
Providing an option to use the tracing implementations span id will completely remove this cost.
The text was updated successfully, but these errors were encountered:
rohitprg
changed the title
span-reporter span id generation is very slow
span-reporter span id generation is very slow.
Oct 11, 2021
java-span-reporter/span-reporter/src/main/java/io/opentracing/contrib/reporter/SpanBuilderR.java
Line 113 in 6e65e7f
Span reporter uses UUID.randomUUID() to generate the span id, which internally uses SecureRandom and is very slow.
Whereas tracer server like Jaeger uses Java6CompatibleThreadLocalRandom.current().nextLong() which is 10 times faster with no contention(one thread) and around 50 to 100 times faster with contention (multilple threads) compared to UUID.randomUUID().
Instead of creating its own span id, span reporter can get the span id from the tracing implementation i.e. wspan.context().toSpanId(). Could span-reporter use random instead of uuid or something like below??
This is a picture profiled on my production server. The cost comes from the following areas:
Providing an option to use the tracing implementations span id will completely remove this cost.
The text was updated successfully, but these errors were encountered: