Details

    • Type: Maintenance
    • Status: Done
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: Carry Over - Fall
    • Labels:
      None

      Description

      Measure performance of Create document API using NewRelic

      Need to check performance of API.
      (targeted timing < 500ms, < 200ms nice to have)

        Attachments

          Activity

          swapnil.pandhare Swapnil Pandhare (Inactive) created issue -
          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Field Original Value New Value
          Epic Link DMS-473 [ 75966 ]
          samir Samir made changes -
          Description Measure performance of Create document API using NewRelic Measure performance of Create document API using NewRelic

          Need to check performance of API.
           (targeted timing < 500ms, < 200ms nice to have)
          samir Samir made changes -
          Sprint DMS - Fall Sprint 1 [ 160 ]
          harshveer.singh Harshveer Singh (Inactive) made changes -
          Status To Do [ 10000 ] In Progress [ 3 ]
          shashikant.mishra ShashiKant Mishra (Inactive) made changes -
          Sprint DMS - Fall Sprint 1 [ 160 ] DMS - Fall Sprint 1, DMS - Fall Sprint 2 [ 160, 161 ]
          samir Samir made changes -
          Remaining Estimate 16h [ 57600 ]
          Original Estimate 16h [ 57600 ]
          Hide
          harshveer.singh Harshveer Singh (Inactive) added a comment - - edited

          I have done some analysis of this API, and main culprit of performance is that there are huge number of DB calls being made during this API execution which we should be able to reduce. Also we don't have caching mechanism right now, there are many redundant queries we are doing around users and user associations which ideally should be cached instead of fetching those details everytime from DB, that will hugely improve this performance. Another performance impact is that we are sending Emails synchronously as part of this API call, below is the breakdown:

           

          CreateDocument

          5523ms: var SrcProductData = commonRoutines.GetLocalizedMetaData(LookupTypeEnum.sourceproduct.ToString(), this.sessionData.LanguageID);

          Inside GetLocalizedMetaData multiple Database queries are being run. Two queries to get code list, if there are N codes then inside a for loop separate DB queries are being run for N times to get data individually. This is huge number of DB queries to get localized data. I will recommend to complete this operation in one DB call and also this data can be cached. But before that, effort here seems to get the sourceProductId, for which a single query can be drafted.

          3331ms: responseMessagesList = ValidateData(dmsFields, candidateData);

          Here also we see at-least two separate DB queries being fired to validate data, for some case it will again call GetLocalizedMetaData which itself fires multiple DB queries. We will need to simplify this validation logic also here. Caching should also be introduced for frequently used person detail fields.

          21946ms: ProcessData(candidateData.Email, dmsFields, candidateData, ref mappedFields); 

          This method usages a helper function to get personId from Email which itself fires 3 DB queries, first this can be simplified to get this in single DB call, and on top of that, for this kind of helper methods we should have caching. After that "objEditForms.ProcessPDFData(dmsFieldsDictionary, personId, dynamicPayload.RequisitionId);", this method itself makes multiple DB calls to update person data, this kind of updates can also be moved to SP for better performance.

          19755ms: responseMessagesList = PreviewAndSendEmail(candidateData);

          Here again we make use of "GetPersonIdFromEmail" helper methods which itself is making multiple DB calls. In "SendFormToSingleCandidate", we are creating document and again making query to get Id for that document, this can be simplified.  There are many more DB queries being executed in separate statements, we can consider moving to SP. Also we are sending Email synchronously which is also blocking the execution untill the email gets sent, this we can move to asynchronous execution.

          IntegrationBaseController(5634ms): 

          There are multiple separate DB queries being exuected here for each API which is called through OneIAM. Preferable we should have caching for common user properties and associations. WE can consider modifing logic to reduce number of DB calls to accomplish same validation or moving validation where multiple DB calls are required to a SP.

          Show
          harshveer.singh Harshveer Singh (Inactive) added a comment - - edited I have done some analysis of this API, and main culprit of performance is that there are huge number of DB calls being made during this API execution which we should be able to reduce. Also we don't have caching mechanism right now, there are many redundant queries we are doing around users and user associations which ideally should be cached instead of fetching those details everytime from DB, that will hugely improve this performance. Another performance impact is that we are sending Emails synchronously as part of this API call, below is the breakdown:   CreateDocument 5523ms: var SrcProductData = commonRoutines.GetLocalizedMetaData(LookupTypeEnum.sourceproduct.ToString(), this.sessionData.LanguageID); Inside GetLocalizedMetaData multiple Database queries are being run. Two queries to get code list, if there are N codes then inside a for loop separate DB queries are being run for N times to get data individually. This is huge number of DB queries to get localized data. I will recommend to complete this operation in one DB call and also this data can be cached. But before that, effort here seems to get the sourceProductId, for which a single query can be drafted. 3331ms: responseMessagesList = ValidateData(dmsFields, candidateData); Here also we see at-least two separate DB queries being fired to validate data, for some case it will again call GetLocalizedMetaData which itself fires multiple DB queries. We will need to simplify this validation logic also here. Caching should also be introduced for frequently used person detail fields. 21946ms: ProcessData(candidateData.Email, dmsFields, candidateData, ref mappedFields);   This method usages a helper function to get personId from Email which itself fires 3 DB queries, first this can be simplified to get this in single DB call, and on top of that, for this kind of helper methods we should have caching. After that "objEditForms.ProcessPDFData(dmsFieldsDictionary, personId, dynamicPayload.RequisitionId);", this method itself makes multiple DB calls to update person data, this kind of updates can also be moved to SP for better performance. 19755ms: responseMessagesList = PreviewAndSendEmail(candidateData); Here again we make use of "GetPersonIdFromEmail" helper methods which itself is making multiple DB calls. In "SendFormToSingleCandidate", we are creating document and again making query to get Id for that document, this can be simplified.  There are many more DB queries being executed in separate statements, we can consider moving to SP. Also we are sending Email synchronously which is also blocking the execution untill the email gets sent, this we can move to asynchronous execution. IntegrationBaseController(5634ms):   There are multiple separate DB queries being exuected here for each API which is called through OneIAM. Preferable we should have caching for common user properties and associations. WE can consider modifing logic to reduce number of DB calls to accomplish same validation or moving validation where multiple DB calls are required to a SP.
          Hide
          samir Samir added a comment -

          Hi Swapnil Pandhare,

          Please resolve these DB call issue. Let me know if you need a call to go through this

          Regards,

          Samir

           

          Show
          samir Samir added a comment - Hi Swapnil Pandhare , Please resolve these DB call issue. Let me know if you need a call to go through this Regards, Samir  
          samir Samir made changes -
          Assignee Harshveer Singh [ harshveer.singh ] Swapnil Pandhare [ swapnil.pandhare ]
          harshveer.singh Harshveer Singh (Inactive) made changes -
          Attachment Pef.PNG [ 106314 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Status In Progress [ 3 ] To Do [ 10000 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Status To Do [ 10000 ] In Progress [ 3 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) logged work - 03/May/19 06:10 AM
          • Time Spent:
            2h
             

            Getlocalizemetadata refactoring

          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Remaining Estimate 16h [ 57600 ] 14h [ 50400 ]
          Time Spent 2h [ 7200 ]
          Worklog Id 176186 [ 176186 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) logged work - 06/May/19 06:02 AM
          • Time Spent:
            4h
             

            Coding - 1st, 2nd and 4th point

            Discussion

          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Remaining Estimate 14h [ 50400 ] 10h [ 36000 ]
          Time Spent 2h [ 7200 ] 6h [ 21600 ]
          Worklog Id 176415 [ 176415 ]
          Hide
          swapnil.pandhare Swapnil Pandhare (Inactive) added a comment -

          Hi All,

          Below is the update till 6th may : 

          commonRoutines.GetLocalizedMetaData(LookupTypeEnum.sourceproduct.ToString(), this.sessionData.LanguageID);

          • Multiple queries and loops removed from this method and created a single query. This is called on almost every page from UI and Integration API requests.

          3331ms: responseMessagesList = ValidateData(dmsFields, candidateData);

          • Multiple queries and loops removed from *GetLocalizedMetaData*method and created a single query. This is called on almost every page from UI and Integration API requests.

           

          19755ms: responseMessagesList = PreviewAndSendEmail(candidateData);

           "GetPersonIdFromEmail" -Removed multiple DB calls from this routine.

          In "SendFormToSingleCandidate" - Simplified the query to get documentid. Also, now emails are sent asynchronously.

          Show
          swapnil.pandhare Swapnil Pandhare (Inactive) added a comment - Hi All, Below is the update till 6th may :  commonRoutines.GetLocalizedMetaData(LookupTypeEnum.sourceproduct.ToString(), this.sessionData.LanguageID); Multiple queries and loops removed from this method and created a single query. This is called on almost every page from UI and Integration API requests. 3331ms: responseMessagesList = ValidateData(dmsFields, candidateData); Multiple queries and loops removed from *GetLocalizedMetaData*method and created a single query. This is called on almost every page from UI and Integration API requests.   19755ms: responseMessagesList = PreviewAndSendEmail(candidateData);  "GetPersonIdFromEmail" -Removed multiple DB calls from this routine. In "SendFormToSingleCandidate" - Simplified the query to get documentid. Also, now emails are sent asynchronously.
          swapnil.pandhare Swapnil Pandhare (Inactive) logged work - 07/May/19 12:00 AM
          • Time Spent:
            4h
             

            Coding
            Discussion

          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Remaining Estimate 10h [ 36000 ] 6h [ 21600 ]
          Time Spent 6h [ 21600 ] 10h [ 36000 ]
          Worklog Id 176694 [ 176694 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) logged work - 08/May/19 12:00 AM
          • Time Spent:
            4h
             

            Coding
            Discussion

          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Remaining Estimate 6h [ 21600 ] 2h [ 7200 ]
          Time Spent 10h [ 36000 ] 14h [ 50400 ]
          Worklog Id 176928 [ 176928 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Status In Progress [ 3 ] Code Review [ 11801 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Status Code Review [ 11801 ] In Progress [ 3 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) logged work - 09/May/19 12:00 AM
          • Time Spent:
            2h
             

            Coding
            Creating PR

          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Status In Progress [ 3 ] Code Review [ 11801 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Remaining Estimate 2h [ 7200 ] 0h [ 0 ]
          Time Spent 14h [ 50400 ] 16h [ 57600 ]
          Worklog Id 177137 [ 177137 ]
          swapnil.pandhare Swapnil Pandhare (Inactive) made changes -
          Assignee Swapnil Pandhare [ swapnil.pandhare ] Rohan J Khandave [ rohan.khandave ]
          Show
          swapnil.pandhare Swapnil Pandhare (Inactive) added a comment - PR :  https://github.com/cbdr/DMS/pull/553
          rohan.khandave Rohan J Khandave (Inactive) made changes -
          Assignee Rohan J Khandave [ rohan.khandave ] Swapnil Pandhare [ swapnil.pandhare ]
          Raj.Hawaldar Raj Hawaldar (Inactive) made changes -
          Status Code Review [ 11801 ] In QA Testing [ 11901 ]
          Raj.Hawaldar Raj Hawaldar (Inactive) made changes -
          Assignee Swapnil Pandhare [ swapnil.pandhare ] Priya Dhamande [ priya.dhamande ]
          priya.dhamande Priya Dhamande (Inactive) made changes -
          Assignee Priya Dhamande [ priya.dhamande ] Samir [ samir ]
          harshveer.singh Harshveer Singh (Inactive) logged work - 28/May/19 11:30 AM
          • Time Spent:
            8h
             
            <No comment>
          samir Samir made changes -
          Assignee Samir [ samir ] Priya Dhamande [ priya.dhamande ]
          priya.dhamande Priya Dhamande (Inactive) logged work - 16/Jul/19 01:08 AM
          • Time Spent:
            0.25h
             

            discussion and update

          Hide
          priya.dhamande Priya Dhamande (Inactive) added a comment -

          As per discussion with Harshveer Singh, No action required from QA end. So, marking this jira done.

          Samir Sachin Hingole Hrishikesh Deshpande Rohan J Khandave

          Show
          priya.dhamande Priya Dhamande (Inactive) added a comment - As per discussion with Harshveer Singh , No action required from QA end. So, marking this jira done. Samir Sachin Hingole Hrishikesh Deshpande Rohan J Khandave
          priya.dhamande Priya Dhamande (Inactive) made changes -
          Resolution Done [ 10000 ]
          Status In QA Testing [ 11901 ] Done [ 10001 ]
          priya.dhamande Priya Dhamande (Inactive) made changes -
          Assignee Priya Dhamande [ priya.dhamande ] Harshveer Singh [ harshveer.singh ]
          priya.dhamande Priya Dhamande (Inactive) made changes -
          Time Spent 16h [ 57600 ] 16.25h [ 58500 ]
          Worklog Id 188617 [ 188617 ]
          harshveer.singh Harshveer Singh (Inactive) logged work - 23/Jul/19 11:22 PM
          • Time Spent:
            5h
             
            <No comment>
          harshveer.singh Harshveer Singh (Inactive) made changes -
          Time Spent 16.25h [ 58500 ] 21.25h [ 76500 ]
          Worklog Id 206062 [ 206062 ]
          harshveer.singh Harshveer Singh (Inactive) made changes -
          Time Spent 21.25h [ 76500 ] 29.25h [ 105300 ]
          Worklog Id 206249 [ 206249 ]
          Transition Time In Source Status Execution Times
          Swapnil Pandhare (Inactive) made transition -
          In Progress To Do
          2d 23h 43m 1
          Swapnil Pandhare (Inactive) made transition -
          To Do In Progress
          5d 17h 45m 2
          Swapnil Pandhare (Inactive) made transition -
          Code Review In Progress
          14s 1
          Swapnil Pandhare (Inactive) made transition -
          In Progress Code Review
          6d 3h 26m 2
          Raj Hawaldar (Inactive) made transition -
          Code Review In QA Testing
          4d 23h 47m 1
          Priya Dhamande (Inactive) made transition -
          In QA Testing Done
          62d 22h 34m 1

            People

            Assignee:
            harshveer.singh Harshveer Singh (Inactive)
            Reporter:
            swapnil.pandhare Swapnil Pandhare (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 16h Original Estimate - 16h
                16h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 29.25h
                29.25h