Skip to content

Skip property population if entity can be constructed entirely using a full constructor [DATAJDBC-546] #766

@spring-projects-issues

Description

@spring-projects-issues

MyeongHyeonLee opened DATAJDBC-546 and commented

Improves the performance of the BasicJdbcConverter$ReadingContext populateProperties.

In populateProperties, PreferredConstructor checks to populate only the property, not the constructor parameter.

However, in a concurrency situation, PreferredConstructor#isConstructorParameter is CPU intensive and causes delays.

 

In fact, when the concurrent traffic was high in the service using Spring Data JDBC, the CPU usage increased a lot. As a result of profiling, PreferredConstructor#isConstructorParameter was using a lot of CPU. (Related issue and profiling: https://jira.spring.io/browse/DATACMNS-1706)

 

In my case, I have 15 columns mapped to a property in one table, and 120 row ResultSets in one SQL. Hit PreferredConstructor#isConstructorParameter method 1800(15*120) times in one request.

At 600 TPS, there is a delay as CPU usage increases. (Hit 1,080,000 per 1 sec)

 

Without calling PreferredConstructor#isConstructorParameter, it can improve to populate by filtering only the properties that are not used in Constructor.

 

Simply compare the delay time with a benchmark and you will see results that improve performance. (https://github.com/mhyeon-lee/spring-data-jdbc/pull/1)

 

 


Affects: 2.0 GA (Neumann)

Issue Links:

  • DATACMNS-1706 PreferredConstructor needs to improve bottleneck occurrence

Referenced from: pull request #220

Backported to: 2.0.1 (Neumann SR1), 1.1.8 (Moore SR8)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions