speedup context injection matchers#1261
Conversation
1a69726 to
2cf9798
Compare
There was a problem hiding this comment.
Yes, that assumption sounds reasonable to me, but I think it speaks to the fact that our abstraction isn't quite right.
It seems to me that the contextClasses should carry a ClassLoaderMatcher constraint that is incorporated into the Instrumenter activation implicitly. An Instrumenter could safely add additional criteria, but cannot remove the requirement needed by the contextClasses.
There was a problem hiding this comment.
Yes, our abstractions are wrong and I'm not immediately sure how to fix that. I think we have to introduce the notion of 'compound instrumenter' - i.e. 'instrumenter' that covers multiple instances of Instrumenter.Default and defines common settings for them.
Currently we do not have this mechanism.
There was a problem hiding this comment.
We ended up disabling field injection of Runnables and Callables when classloader matchers were added for AkkaForkJoinPool and ScalaForkJoinPool because they share context stores with the RunnableInstrumentation and CallableInstrumentation - see #1910
There was a problem hiding this comment.
A Set<Map.Entry<String, String>> looks rather odd. My first thought was how this different from a Setof just the Entry keys. But I guess we're accumulating this from multiple maps, so it makes sense. Still not very obvious.
I also think there's likely a better option than reducing statics here. Ultimately, the reset boundary is contained by the caller, so I think it would be better for the caller to construct and pass in object rather than introducing a static that the caller must remember to reset.
There was a problem hiding this comment.
I do not have a strong opinion here overall, but I feel passing it from 'outside' has two problems:
- We spread way to much internal knowledge outside
- We would pipe it through quite a few levels
Overall I'm not sure it's worth the effort. Proper fix here is to fix our abstraction (with compound instrumenter of something) so we do not have to resort to this hack. But as far as hack goes I do not think that passing set all over the place is much better than using static.
There was a problem hiding this comment.
For me, the need to have the caller call reset is spreading the outside knowledge.
But I think this is fine for now, I think we agree the real issue is that we're missing a concept that connects multiple related Instrumenters. But I don't think, we should try to fix that in this PR.
There was a problem hiding this comment.
I know this wasn't part of this change, but I think we might be well served to move the construction of this Matcher into a helper method. Doesn't need to be part of this PR.
There was a problem hiding this comment.
I'm actually questioning correctness of this matcher at all - i have a feeling we should not put it here at all
There was a problem hiding this comment.
I'll look into this as separate PR.
9b711c9 to
3723b4f
Compare
3723b4f to
d53c138
Compare
|
While performing a perf integration test, I accidentally merged this prematurely to master. Since this has passed reviews, we should resolve the conflicts and get this merged through the normal means. |
538987b to
cf5fe9f
Compare
This provides 0.5-1s speedup on petclinic app on java8.
There is still a question on how to make different classloader matchers not break things - but even in current state this should be functionally correct.