0 Replies Latest reply on Sep 9, 2014 3:03 AM by sivaraj thavamani

    Does performance issue for each request getting the session and close the session?

    sivaraj thavamani Newbie


      I need a clarification about session performance. I have created session pool(LocalSessionFactoryBean). I mean for each thread request I am getting a session(not created new one) from pool. For each request(from controller to serviceImpl), I am getting a session and once request is completed I just close the session. In this case, I feel session(currentSession and close session) is cause of performance issue for following ways. Please suggest me, which way is best in this situation.


      #WAY 1:




      for (String sdgCode : sdgCodes) {

          //For each sdgCode, I am calling serviceImpl

          // As per my knowledge, We are getting a session / close the session for each service request

          for (Feature sdgFeature : planService.getSharedDataGroupsFeature(sdgCode)) {





      #WAY 2:




      //One serviceImpl request and get the all feature objects

      //Only one session will play the role here. Only one time close the session.

      List<Feature> features = planService. getSharedDataGroupsFeatures(sdgCodes);

      for (Feature sdgFeature : features ){




      Conclusion : Is it performance issue for each time getting the session from session pool and close the session for each request once request has been completed? Please suggest me…