-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
BeanUtils.copyProperties() consumes large amount of memory #27246
Comments
Can you post your I'm not a spring framework contributor, just trying to help with triage; you could fork the repo; and adapt the unit test to your scenario. Running corresponding test on both versions, time for test execution is less than 0.0s :
Time:
Time
|
I am sorry, but I'm afraid that you did not get what I was meaning. I want to point out that there were large amount of objects created by By the way, the TestBean has only 16 String field with getter and setter. And in my test, I set JVM flag as |
I'm trying to help with triage, help the community. |
Thanks for reply.
I checked the source code for 5.3.x, there is no cache for ResolvableType currently which result in Many ResolvableType objects are created while make one call of
That's not the point. After upgrade to Spring 5.3.x, we observed large increase in YoungGC frequency (Before upgrade: One YoungGC in every 20s; After upgrade: One YoungGC in every 1s). The objects created(not promoted) is increased from 200MB/s to nearly 2GB/s. Therefore I tried to find the problem and then I found very large amount of ResolvableType objects were created which took up large amount of memory. To prove that, I provided a simple Test here which use Experimental flags (just for limiting the memory and proving there are much more memory used than before). And my Test prove that there are large amount of memory consumed compared with the case not upgraded (If you check jmap -histo, you would find they are taken up mainly by ResolvableType). |
It not only consumes a lot of memory, but also has a lot of performance degradation |
Please investigate which commit from history cause such regression. |
found in e74f868. |
@sbrannen I lack of context to be able to analyze efficiently this potential performance regression, could you please take care of it? The data points shared are pretty significant, so it is IMO worth a deeper look. |
After upgrade from 5.2.x to 5.3.x, we observed large increase in YoungGC caused by huge amount of object created. After test we found that is because BeanUtils.copyProperties().
In 5.3.x, using ResolvableType to increase fitness but there is no cache which would cause there are many ResolvableType objects created and result in large memory consuming. And there is a comparasion:
the VM option is
-XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xmx512m
, the program will exit when the memory run out.For 5.2.x, the last i is:
For 5.3.x, the last i is:
That's a huge memory consuming.
The text was updated successfully, but these errors were encountered: