Skip to content

Reduce String allocations in TransactionAspectSupport.methodIdentification() [SPR-14760] #19326

@spring-projects-issues

Description

@spring-projects-issues

Christoph Dreis opened SPR-14760 and commented

Hey,

in some of my recent tests I noticed a rather "high" pressure on the heap coming from TransactionAspectSupport.methodIdentification(). (The image below shows the result of a 10 minute flight recording) for StringBuilder.append(String). Of course there are some more MBs (~200) allocated for the StringBuilder and the actual toString() calls - in case you need this data as well - just tell me.

!transaction-methodIdentification.jpg|thumbnail!

As far as I understood the method it's "just" used for logging and monitoring - both of which are disabled in most situations, I'd say. Is this observation correct? Unfortunately, I didn't figure out yet how to implement my own version of TransactionAspectSupport inside a Spring-Boot app in order to workaround the problem at least for us, but that might be an issue for Boot after all.

Nonetheless, I attached a small PR that should at least force the compiler to concat the dot with a char instead of a String. Maybe this is the first step for 4.x until you can maybe come up with something smarter in 5.x.

Cheers,
Christoph


Affects: 4.3.3

Attachments:

Issue Links:

Referenced from: pull request #1186

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions