Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the queries executed in APIM 4.1.0 when loading thubmnail/ratings #1988

Closed
ksankeerth opened this issue Jul 7, 2023 · 1 comment
Closed

Comments

@ksankeerth
Copy link

Problem

We have noticed that APIM 4.1.0 execute more queries to load thumbnail and rating compared to APIM 3.2.0

Solution

In the analysis, We found that the amount of queries can be reduced by

Avoid redundant permission checks for registry resources

APIM will do the following when loading thumbnail and rating.

We’ll load lightweight info of API 

In the code flow, We’ll get the registry 

After that, We’ll load tenant specific API RXT file 

In the method loadloadTenantAPIRXT , we’ll load the RXT file from the filesystem and try to check its existence in the Gov Registry. Regardless of if it exists or not, We’ll add Authorize role (set read access to anonymous role) 

JDBCAuthorizationManager will be used to add access to anonymous role for registry resource

JDBCAuthorizationManager will load the permissions for the given resource first and add permission if it does not exist. (SELECT UM_ID FROM UM_PERMISSION WHERE UM_RESOURCE_ID='/_system/governance/repository/components/org.wso2.carbon.governance/types/api.rxt' AND UM_ACTION='http://www.wso2.org/projects/registry/actions/get' AND UM_TENANT_ID='-1234'

)

APIM would do the same for the below resources "provider.rxt", "api.rxt", "productdocument.rxt.", "documentation.rxt.", "product.rxt"
Further, loading thumbnail and rating requests will be initiated by user's visit (https://localhost:9443/devportal/apis) after authentication. For each and every APIs, separate requests to load rating and thumbnail will be sent to the backend.

For resource path not found scenario, db is queried every time. To improve the performance, this 'not-found' state for the provided path is cached.

Affected Component

APIM

Version

4.1.0

Implementation

No response

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants