ClassLoaderMatcher put to Guava Cache outside critical section#1244
Conversation
e8a916e to
37bcb4e
Compare
| private final LoadingCache<ClassLoader, Boolean> cache = | ||
| CacheBuilder.newBuilder() | ||
| .weakKeys() | ||
| .build( |
There was a problem hiding this comment.
We might also want to set the concurrency level. I picked 8 for the type cache.
Although, we should add a configuration option in a separate PR -- and maybe auto-select by availableProcessors.
There was a problem hiding this comment.
Be careful with availableProcessors - it may be a lie in k8s land...
There was a problem hiding this comment.
Yes, that is true. We probably want to a cap on it. Although, I suspect for concurrency level we're better off err-ing slightly on the high-side.
fc04446 to
464d71e
Compare
Yes, I've tried w/o Supplier and it slightly better. But when we move to generic WeakCache abstraction, it will have the supplier (some anonymous class to load the cache) anyway: https://github.com/DataDog/dd-trace-java/blob/lpriima/WeakCache/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/WeakCache.java#L38 Updated this PR without Supplier anyway. |
Looks like this gives us a nice win right now, so I'm satisfied with this as is. We'll also want to look at any places using WeakMap and see if they are candidates for using WeakCache instead. |
it will be in 2 places here in this PR plus in all other places here: https://github.com/DataDog/dd-trace-java/pull/1256/files |
464d71e to
885212e
Compare
|
While performing a perf integration test, I accidentally merged this prematurely to master. Since this has passed reviews, we should get this merged through the normal means. |
|
ok. Merging |

petclinic 100 runs avg start time:
before: 51ca429 avgTime : 18.49126000000000000000
after: 01b32d814fdcf1de9df46a7185ed78daf981434d avgTime : 17.60960000000000000000