-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FISH-5636 Remote EJB Tracing Improvements #5410
Conversation
Signed-off-by: Andrew Pielage <[email protected]>
…nd only get tracer once in StandardWrapper Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]> FISH-5636 Correct try-catch Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
// Does this NEED to be synchronised? Tracers don't store state, and Scopes are ThreadLocal | ||
|
||
// Double-checked locking - potentially naughty | ||
Tracer tracer = tracers.get(applicationName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about ConcurrentHashMap.computeIfAbsent and put the following code into the compute function?
return requestTracingService.isRequestTracingEnabled(); | ||
} | ||
return false; | ||
} | ||
|
||
public RequestTracingService getRequestTracingService() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about returning an Optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think returning an Optional really adds much here.
The method is intended as a poke to HK2 if required rather than any kind of true getter (public scope currently present is wrong - should be private).
Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
Jenkins test please |
FISH-5636 Remote EJB Tracing Improvements
…unity" This reverts commit 12c988f.
Description
An attempt to improve the throughput of the OpenTracing service, particularly with regards to remote EJBs.
The main change is the un-synchronising of the
getTracer
method - creation of tracers is still synchronised but is now split off into another method and utilises double-checked locking to prevent conflicts. While double-checked locking can be naughty, in this case it's being done on a map itself, so the issue of partially constructed references not returning null Shouldn't™ occur.My results from performance testing were largely inconclusive since the realm of variance is pretty large - this is working at the micro and millisecond timeframe, any slight deviation outside of my control (e.g. OS runs a background process) will affect the result. In any case, I shall list the reasoning of how each change should help below.
getTracer
split into two methods:getTracer
andcreateTracer
getTracer
is now unsynchronised, meaning there should be less contention waiting for locks in normal operation since onlycreateTracer
is synchronised (tracers only get created once)StandardWrapper
no longer does two calls forgetTracer
back-to-back (less of an impact now thatgetTracer
is no longer synced but still saves performing the get operation on a ConcurrentHashMap twice)RequestTracingService
moved fromSpanBuilder
constructor toOpenTracingService
(and then passed toTracer
as a constructor parameter). The intent here is to make it so an HK2 lookup doesn't need to be performed each time a span is created, and is instead done once.This PR also includes some cleanup of deprecated or ugly code:
log
was missing and so I added it inGlobalTracer.register(Tracer)
is deprecated, so has been replaced withGlobalTracer.registerIfAbsent(Callable)
GlobalTracer.registerIfAbsent(Callable)
Events
from constructor ofRequestTraceStoreFactory
- not used.DAY
variable removed fromRequestTracingService
- not used.ScopeManager
moved fromOpenTracingService
toTracer
- it isn't used anywhere else, and ourTracer
impl doesn't use any other kind ofScopeManager
Important Info
Dependant PRs
MicroProfile OpenTracing TCK Runner update: payara/MicroProfile-TCK-Runners#153
Blockers
None
Testing
New tests
None - with the level of sensitivity being worked on here (milliseconds) performance tests are not suitable for day-to-day testing.
Testing Performed
Ran my own test using JMeter numerous times against various points on the branch and compared against master - results largely inconclusive. Added my own logging around every call to
getTracer
to try and get a sense of the response time of synchronised vs. un-synchronised (inconclusive).Ran a test created by @fturizo and inspected using JProfiler numerous times against various points on the branch and compared against master to see if any discernible difference could be gained (inconclusive).
Ran MicroProfile OpenTracing TCK to check everything still works.
Test suites executed
MicroProfile OpenTracing
Testing Environment
Windows 10, JDK8.
Documentation
N/A
Notes for Reviewers
Please keep performance in mind when reviewing, pointing out stuff I've missed or things I may have misunderstood.