...
The last step (lines 374-375) is to create appropriate DTO objects based on database objects and send response to the client. Like was written above if a requisition contains more external data, the longer it takes to convert business object into DTO object.
Scalyr
Additional I checked the system usage when the requisition search endpoint is executed. This time I used our training server where there are more than 90,000 requisitions in RELEASED status. After 15 minutes a user gets 504 error message from backend. It seems like there is no problem with CPU, disk or memory usage but more with the service-to-service communication because of huge network usage (Network bandwidth graph).
Solutions
- Stop using search endpoint on the Create/Authorize view Currently two endpoints are used to create appropriate period list on UI. It would be good to move this on the server side and create a single endpoint (or modify existing one) that would return a list of available periods for the given facility and program,
- Split Requisition DTO object into two objects where one contains only base information and second that contain all necessary data for UI,
Modify domain object that they will not retrieve related data automatically for example a requisition should not retrieve related line items,
Move pagination to database layer.