Performance improvements for all supply line endpoints

Description

Acceptance criteria

  • measure the execution time

  • if p90 > 500ms try to modify the endpoint to achieve the requirement

  • verify the performance of GetAPageOfTenRequisitionsForConvert is better (SEARCH_FOR_SUPPLY_LINES] 4106.429 ms) - ideally this should be <500ms

Dev notes

Attachments

7

QAlity Plus - Test Management

Checklists

Activity

Mateusz Kwiatkowski 
March 20, 2019 at 6:11 PM
(edited)

for conver before


for convert after

supply lines

As shown on those screenshots Convert to order was taking ~5000ms, now it's taking ~500ms
As for supply lines:

  • Getting all 1000 supply lines was taking from 10s to 17s, now it takes less than 0.5s (also with expand)

  • Searching supply lines by supplying facility id etc. was taking from 8s to 12s, now it takes less than 0.5s (line90 less than 200ms)

I think that it is worth mentioning, that previous implementation was not returning whole requisition group with member facilities, where now when using expand, endpoint returns requisition group with member facilities.

Mateusz Kwiatkowski 
March 20, 2019 at 6:01 PM

Here is a profiler log for SupplyLineController searchSupplyLines method before performance fixes:
[SEARCH_SUPPLY_LINES]#012|-- elapsed time [CREATE_SEARCH_PARAMS_CLASS] 0.005 milliseconds.#012|-- elapsed time [REPOSITORY_SEARCH] 2987.469 milliseconds.#012|-- elapsed time [BUILD_DTO] 1756.886 milliseconds.#012|-- Total [SEARCH_SUPPLY_LINES] 4744.366 milliseconds.

Here is a profiler log for SupplyLineController search method after performance fixes:
[SEARCH_SUPPLY_LINES]#012|-- elapsed time [CREATE_SEARCH_PARAMS_CLASS] 0.009 milliseconds.#012|-- elapsed time [REPOSITORY_SEARCH] 149.781 milliseconds.#012|-- elapsed time [BUILD_DTO_WITH_EXPAND] 0.030 milliseconds.#012|-- Total [SEARCH_SUPPLY_LINES] 149.824 milliseconds.

Improvement from 4744.366 milliseconds to 149.824 milliseconds

Here is a profiler log for RequisitionService searchApprovedRequisitions method before performance fixes:
[SEARCH_APPROVED_REQUISITIONS_SERVICE]#012|-- elapsed time [GET_CURRENT_USER] 30.381 milliseconds.#012|-- elapsed time [GET_PERMISSION_STRINGS] 55.212 milliseconds.#012|-- elapsed time [FILTER_PERMISSION_STRINGS] 1.372 milliseconds.#012|-- elapsed time [SEARCH_FOR_SUPPLY_LINES] 4742.853 milliseconds.#012|-- elapsed time [SEARCH_APPROVED_REQUISITIONS] 3.167 milliseconds.#012|-- elapsed time [BUILD_DTOS] 200.777 milliseconds.#012|-- elapsed time [PAGINATE] 0.007 milliseconds.#012|-- Total [SEARCH_APPROVED_REQUISITIONS_SERVICE] 5033.777 milliseconds.

Here is a profiler log for RequisitionService searchApprovedRequisitions method after performance fixes:
[SEARCH_APPROVED_REQUISITIONS_SERVICE]#012|-- elapsed time [GET_CURRENT_USER] 27.062 milliseconds.#012|-- elapsed time [GET_PERMISSION_STRINGS] 44.180 milliseconds.#012|-- elapsed time [FILTER_PERMISSION_STRINGS] 0.969 milliseconds.#012|-- elapsed time [SEARCH_FOR_SUPPLY_LINES] 181.820 milliseconds.#012|-- elapsed time [SEARCH_APPROVED_REQUISITIONS] 1.426 milliseconds.#012|-- elapsed time [BUILD_DTOS] 144.841 milliseconds.#012|-- elapsed time [PAGINATE] 0.007 milliseconds.#012|-- Total [SEARCH_APPROVED_REQUISITIONS_SERVICE] 400.313 milliseconds.

Improvement from 5033.777 milliseconds to 400.313 milliseconds

Joanna Bebak 
March 20, 2019 at 1:52 PM

I made a re-test, and now everything works correctly.

Mateusz Kwiatkowski 
March 20, 2019 at 10:15 AM

I think that it was caused by outdated changes on the UAT server. Please check it now and remember about clearing cache. After you are done with testing please assign this ticket to me and move to in progress because I still need to remove feature flag here.

Joanna Bebak 
March 20, 2019 at 7:17 AM

I made a re-test and unfortunately, the supply lines are still not sorted correctly with the flag enabled. The sort is a bit different but still, it's not the correct one:

Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Original estimate

Time tracking

2w 2h logged

Components

Sprint

Fix versions

Priority

Time Assistant

Created November 16, 2017 at 7:05 AM
Updated November 20, 2020 at 8:09 PM
Resolved March 21, 2019 at 10:09 AM