-
-
Notifications
You must be signed in to change notification settings - Fork 797
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
consider changing InternCache #946
Comments
My initial reaction is that whenever blocking is reported, it is a pretty good indicator problem quite different from Put another way, optimizing I am not against possible pluggability of I would be -1 for moving Another thing that may be relevant: while interning is allowed in 3.0, it is disabled by default. So this issue will have less relevance if we ever move to Jackson 3.x. |
Interning introduces excessive contention FasterXML/jackson-core#946
@schlosna If there was a reproduction, I could try to have a look. This would suggest some problem with reusing of symbol tables, or a very big set of distinct names (filling symbol table leading to flushing). |
Thanks @cowtowncoder I'll see if we can create a smaller repro/benchmark. My sense is in our case we have many distinct symbols, so the interning cache is constantly flushing, and then becomes a synchronization bottleneck across threads using the same ObjectMapper instance for deserialization, so we may be better off disabling the interning. Related, but slightly separate, we may benefit from enabling GC string deduplication to handle this for any long lived strings. |
I believe the issue is the result of |
I've created a PR with a failing test here: FasterXML/jackson-databind#3859 |
@carterkozak Ok as per my notes ALL JSON Object keys will get canonicalize -- or none will. Or in cases where keys just do not repeat (like UUIDs). In such cases there's very little point in optimizing |
@cowtowncoder is there any chance you would consider making InternCache non-final and adding a static method that allows the cache |
@pjfanning No, I don't think I want to add static configurability this way. |
As you're already working on this, I'd like to throw in my two cents:
|
I think that due to need for low latency, weak references are probably non starters for general implementation. But if pluggability was added, users could definitely opt for that. In 3.0 (whenever we get there), intern()ing is not the default any more, so that may be more of a permanent solution eventually. I am not against pluggability, maybe that could be worked on for 2.17. |
Clears cache when limit of 100 reached. Can cause blocking - eg https://stackoverflow.com/questions/75616007/at-com-fasterxml-jackson-core-util-interncache-interninterncache-java54-in-bl
LRUMap in jackson-databind used to do this but has now been changed to be a proper LRU cache.
InternCache can't use LRUMap but we could consider moving that class to jackson-core.
Alternatives include allowing InternCache to be configured. Size could be configurable or the underlying map implementation could be pluggable.
Also open is #726 and #998
The text was updated successfully, but these errors were encountered: