Uploaded image for project: 'Spring Data JDBC'
  1. Spring Data JDBC
  2. DATAJDBC-546

Skip property population if entity can be constructed entirely using a full constructor

    XMLWordPrintable

    Details

      Description

      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)

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mp911de Mark Paluch
              Reporter:
              myeonghyeonLee MyeongHyeonLee
              Last updater:
              Mark Paluch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: