fix(rest) : Modifications to improve API GET result speed for name search #2096
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #2078
Performance Issues with Name Search via API
Suggest Reviewer
How to test
Using the Rest API of Release, "Acquisition of all records" and "Filtering by name" are executed, and confirm that there is no difference in the response JSON before and after the modification.
Preparation
Use the script below to register 10,000 Release and Component records for testing.
make_dummy_data.zip
1. Retrieving the response before modification
Start the system before merging the changes in this pull request and execute the following commands.
Command line
Command line
2. Retrieving the response after modification
Start the system after merging the changes in this pull request and execute the following commands.
Acquisition of all records
Command line
Expected Output
Filtering by name
Command line
Expected Output
3. Comparison of response JSON before and after changes
Confirm that there is no difference in the response JSON before and after applying the changes in this pull request.
fix(rest) : Modifications to improve GET result speed
Purpose
Fix bottlenecks in Release API performance issues.
The related issue
Performance Issues with Name Search via API Performance Issues with Name Search via API #2078
Performance Issues with Name Search via API #2078
Bottlenecks
In the Rest API for Relaese, when "Acquisition of all records" or "Filtering by name" is executed, the process of retrieving the ComponentType accounts for about 92% of the processing time.
ReleaseController.getReleasesForUser method:
Improvement effect of this modification
Comparison of processing times (unit: second)
DB has 10000 Release and Component records
The outline of changes
The order of execution of the filtering process by name of Release and the acquisition process of ComponentType is switched.
This reduces unnecessary Component acquisition processing, which is performed for Release records excluded by filter processing.
If the "sha1" or "name" filter is not specified in the request, it is treated as a request to acquire all Release records.
In this case, the process is changed so that all Components records are retrieved in a batch. and the ComponentType is acquired.
If the number of Release records is sufficiently narrowed down by filter conditions, it is more efficient to acquire Component individually, so the conventional processing is performed.
The detail of changes
ReleaseController.java
rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/release/ReleaseController.java
Sw360ReleaseService.java
rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/release/Sw360ReleaseService.java
Limitations
The following Rest API changes may cause performance issues similar to the ComponentType acquisition process.
feat(rest): Add Information Vendor to response Get all Releases detail #2089
#2089
However, since this change is limited to cases where "allDetails" is enabled and also skips Release that do not have a vendor id, we believe the impact is limited.
This pull request does not consider the impact of #2089.