-
Type:
Maintenance
-
Status:
Done
-
Priority:
Medium
-
Resolution:
Done
-
Affects Version/s:
None
-
-
-
Company:
All Clients/Multiple Clients
-
-
Sprint:
DMS - Fall Sprint 1, DMS - Fall Sprint 2
Measure performance of Create document API using NewRelic
Need to check performance of API.
(targeted timing < 500ms, < 200ms nice to have)
{"report":{"apdex":1,"isInitial":true,"journeyId":"99dac9cc-1cca-4182-b6ca-bad5c3c4d6a5","key":"jira.project.issue.view-issue","navigationType":0,"readyForUser":882,"redirectCount":0,"resourceLoadedEnd":673.3999996185303,"resourceLoadedStart":199.09999990463257,"resourceTiming":[{"duration":135.59999990463257,"initiatorType":"link","name":"https://jira.workterra.net/s/3003653444a1e1a85555cab7dcfb3a21-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/2e46d90b5cae895c9c38649c9d510130/_/download/contextbatch/css/_super/batch.css","startTime":199.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":334.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":135.39999961853027,"initiatorType":"link","name":"https://jira.workterra.net/s/dd6a0911920485696ac20493290df627-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/3abe50d469404b639745df44b51476b6/_/download/contextbatch/css/jira.browse.project,jira.view.issue,project.issue.navigator,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&richediton=true","startTime":199.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":334.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":135.7999997138977,"initiatorType":"link","name":"https://jira.workterra.net/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/8.5.0/_/download/batch/com.atlassian.auiplugin:split_aui.pattern.label/com.atlassian.auiplugin:split_aui.pattern.label.css","startTime":199.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":335.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":136.09999990463257,"initiatorType":"link","name":"https://jira.workterra.net/s/bd548f27bbf8f278bd83b60dd3284ed8-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/1.0/_/download/batch/jira.webresources:global-static-adgs/jira.webresources:global-static-adgs.css","startTime":199.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":335.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":136.40000009536743,"initiatorType":"link","name":"https://jira.workterra.net/s/70725731a158a7140f19ddbd4201ba27-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/1.0/_/download/batch/jira.webresources:global-static/jira.webresources:global-static.css","startTime":199.89999961853027,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":336.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":262.2999997138977,"initiatorType":"script","name":"https://jira.workterra.net/s/f2623af22c15df767ec6ff268ae0b8bd-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/2e46d90b5cae895c9c38649c9d510130/_/download/contextbatch/js/_super/batch.js?locale=en-US","startTime":200,"connectEnd":200,"connectStart":200,"domainLookupEnd":200,"domainLookupStart":200,"fetchStart":200,"redirectEnd":0,"redirectStart":0,"requestStart":338.8999996185303,"responseEnd":462.2999997138977,"responseStart":373.3999996185303,"secureConnectionStart":200},{"duration":441.90000009536743,"initiatorType":"script","name":"https://jira.workterra.net/s/6ce676f2a5bcc9651cef6e7956f05def-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/3abe50d469404b639745df44b51476b6/_/download/contextbatch/js/jira.browse.project,jira.view.issue,project.issue.navigator,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en-US&richediton=true","startTime":200.69999980926514,"connectEnd":200.69999980926514,"connectStart":200.69999980926514,"domainLookupEnd":200.69999980926514,"domainLookupStart":200.69999980926514,"fetchStart":200.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":339.59999990463257,"responseEnd":642.5999999046326,"responseStart":376.7999997138977,"secureConnectionStart":200.69999980926514},{"duration":170.5,"initiatorType":"script","name":"https://jira.workterra.net/s/6aa3fcf1fac5fd551eee0b69077524e6-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/aae1242f5fc81cc6a5bb8bc963ccda29/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en-US","startTime":200.89999961853027,"connectEnd":200.89999961853027,"connectStart":200.89999961853027,"domainLookupEnd":200.89999961853027,"domainLookupStart":200.89999961853027,"fetchStart":200.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":341.69999980926514,"responseEnd":371.3999996185303,"responseStart":370.8999996185303,"secureConnectionStart":200.89999961853027},{"duration":233,"initiatorType":"script","name":"https://jira.workterra.net/s/ecf7ec549751ae117b778f0525d6d371-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/4.1.5/_/download/resources/com.atlassian.plugins.atlassian-chaperone:hotspot-tour/hotspot-tour.js?batch=false&locale=en-US","startTime":200.89999961853027,"connectEnd":200.89999961853027,"connectStart":200.89999961853027,"domainLookupEnd":200.89999961853027,"domainLookupStart":200.89999961853027,"fetchStart":200.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":340.5,"responseEnd":433.8999996185303,"responseStart":433.19999980926514,"secureConnectionStart":200.89999961853027},{"duration":234.39999961853027,"initiatorType":"script","name":"https://jira.workterra.net/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":201,"connectEnd":201,"connectStart":201,"domainLookupEnd":201,"domainLookupStart":201,"fetchStart":201,"redirectEnd":0,"redirectStart":0,"requestStart":342.59999990463257,"responseEnd":435.3999996185303,"responseStart":434.7999997138977,"secureConnectionStart":201},{"duration":202.69999980926514,"initiatorType":"script","name":"https://jira.workterra.net/s/ecf7ec549751ae117b778f0525d6d371-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/8.5.0/_/download/batch/com.atlassian.auiplugin:split_aui.pattern.label/com.atlassian.auiplugin:split_aui.pattern.label.js?locale=en-US","startTime":201.09999990463257,"connectEnd":201.09999990463257,"connectStart":201.09999990463257,"domainLookupEnd":201.09999990463257,"domainLookupStart":201.09999990463257,"fetchStart":201.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":345.19999980926514,"responseEnd":403.7999997138977,"responseStart":403.09999990463257,"secureConnectionStart":201.09999990463257},{"duration":233.59999990463257,"initiatorType":"script","name":"https://jira.workterra.net/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":201.09999990463257,"connectEnd":201.09999990463257,"connectStart":201.09999990463257,"domainLookupEnd":201.09999990463257,"domainLookupStart":201.09999990463257,"fetchStart":201.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":343.59999990463257,"responseEnd":434.69999980926514,"responseStart":434,"secureConnectionStart":201.09999990463257},{"duration":142.7000002861023,"initiatorType":"link","name":"https://jira.workterra.net/s/05c862146699bb029ceb0a489075e63b-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/bcd66e9a133a1b9f5fd14b56841e1c5b/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":201.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":344,"responseStart":0,"secureConnectionStart":0},{"duration":144.10000038146973,"initiatorType":"link","name":"https://jira.workterra.net/s/9095228fa10daa2d3e3d7d5760c95e91-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/72477c22780abda5f51fe696920d843f/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.css?jira.create.linked.issue=true&richediton=true","startTime":201.39999961853027,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":345.5,"responseStart":0,"secureConnectionStart":0},{"duration":288.7000002861023,"initiatorType":"script","name":"https://jira.workterra.net/rest/api/1.0/shortcuts/805012/81da1c7492d7ee698ae1cc31902498d9/shortcuts.js?context=issuenavigation&context=issueaction","startTime":201.39999961853027,"connectEnd":201.39999961853027,"connectStart":201.39999961853027,"domainLookupEnd":201.39999961853027,"domainLookupStart":201.39999961853027,"fetchStart":201.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":346.7999997138977,"responseEnd":490.09999990463257,"responseStart":489.3999996185303,"secureConnectionStart":201.39999961853027},{"duration":289,"initiatorType":"script","name":"https://jira.workterra.net/s/c19a1b46e985d7fb85efaf27c8febfdd-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/72477c22780abda5f51fe696920d843f/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.js?jira.create.linked.issue=true&locale=en-US&richediton=true","startTime":201.59999990463257,"connectEnd":201.59999990463257,"connectStart":201.59999990463257,"domainLookupEnd":201.59999990463257,"domainLookupStart":201.59999990463257,"fetchStart":201.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":348,"responseEnd":490.59999990463257,"responseStart":490.09999990463257,"secureConnectionStart":201.59999990463257},{"duration":441.40000009536743,"initiatorType":"script","name":"https://jira.workterra.net/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":228.09999990463257,"connectEnd":228.09999990463257,"connectStart":228.09999990463257,"domainLookupEnd":228.09999990463257,"domainLookupStart":228.09999990463257,"fetchStart":228.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":432.59999990463257,"responseEnd":669.5,"responseStart":669,"secureConnectionStart":228.09999990463257},{"duration":418.3999996185303,"initiatorType":"script","name":"https://jira.workterra.net/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-w431t5/805012/9a9e1fae3639050b38ac467c3aa37e79/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":255,"connectEnd":255,"connectStart":255,"domainLookupEnd":255,"domainLookupStart":255,"fetchStart":255,"redirectEnd":0,"redirectStart":0,"requestStart":447.7999997138977,"responseEnd":673.3999996185303,"responseStart":673.0999999046326,"secureConnectionStart":255},{"duration":90.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.workterra.net/rest/webResources/1.0/resources","startTime":609.5999999046326,"connectEnd":609.5999999046326,"connectStart":609.5999999046326,"domainLookupEnd":609.5999999046326,"domainLookupStart":609.5999999046326,"fetchStart":609.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":625.5999999046326,"responseEnd":700.5,"responseStart":699.8999996185303,"secureConnectionStart":609.5999999046326}],"threshold":1000,"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":88,"responseStart":168,"responseEnd":254,"domLoading":171,"domInteractive":938,"domContentLoadedEventStart":939,"domContentLoadedEventEnd":1007,"domComplete":1389,"loadEventStart":1389,"loadEventEnd":1391,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[],"measures":[],"correlationId":"e493bb16647902","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":47,"dbReadsTimeInMs":4,"dbConnsTimeInMs":5,"applicationHash":"156decd7d2b4272533aa6cefc8294af635e1da97","experiments":[]}}
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.