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
Since we're using a weak reference here instead of a strong reference, once a GC happens, it will cause the JAXBContext to be reinitialized, which is a pretty expensive operation.
In our service, by using a custom JaxbContextResolver, we managed to reduce the response time by about 100ms (P90). So, should we provide an option here to let users decide whether to use strong or weak references?(Or an LRU cache with a size limit) I understand that the purpose of using weak references might be to reduce memory usage, but in reality, many services are more sensitive to response time.
Thanks, I get what you're saying. But with the current logic, if something goes wrong, it'll be really tough for users to figure out the root cause. So, do you think using what we discussed earlier as the new default might be a better way to go?
Thanks, I get what you're saying. But with the current logic, if something goes wrong, it'll be really tough for users to figure out the root cause. So, do you think using what we discussed earlier as the new default might be a better way to go?
The problem with the strong reference is that it could accumulate unused instances during the time. Maybe you improve the performance, but you will get a memory leak too.
We cannot apply that fix as a general solution. I think it is better that you have your custom class to deal with it.
jersey/media/jaxb/src/main/java/org/glassfish/jersey/jaxb/internal/AbstractJaxbProvider.java
Line 284 in d9658aa
Hi everyone!
Since we're using a weak reference here instead of a strong reference, once a GC happens, it will cause the JAXBContext to be reinitialized, which is a pretty expensive operation.
In our service, by using a custom JaxbContextResolver, we managed to reduce the response time by about 100ms (P90). So, should we provide an option here to let users decide whether to use strong or weak references?(Or an LRU cache with a size limit) I understand that the purpose of using weak references might be to reduce memory usage, but in reality, many services are more sensitive to response time.
The text was updated successfully, but these errors were encountered: