BeanFactoryUtils.transformedBeanName() creates a lot of GC pressure [SPR-17151] #21688
Comments
Juergen Hoeller commented So you mean the |
Dave Syer commented Yes, that was it (the substring). |
Juergen Hoeller commented That's a bit surprising... We also concatenate the prefix with the bean name in quite a few places, easily as often as the inverse transformation. I suppose these somehow end up in the JVM's String pool whereas the In any case, I'll try to cache those transformed names in a |
Dave Syer opened SPR-17151 and commented
This is something that popped up while analysing a pathological Spring Data app with 2000 repositories, but it points at a potential general optimization that might help in Spring. The problem is that
BeanFactoryUtils.transformedBeanName()
is called for every bean in the context when someone wants to doDefaultListableBeanFactory.getBeansOfType()
which is quite common in Spring Data and Spring Boot (and other frameworks). This in turn creates a newString
for every factory bean which in turn shows up in the GC pressure graph in Flight Recorder (25% of GC pressure on startup of this extreme example). If the results were somehow cacheable inDefaultListableBeanFactory
that would help.Affects: 5.0.8
Referenced from: commits eddbf13
The text was updated successfully, but these errors were encountered: