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

Optimizing Model Filter Get Method #687

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

souvikinator
Copy link
Contributor

Description

This PR fixes #

Notes for Reviewers
Before:

  • In non-trim mode, when Components or Relationships was set to true in the ModelFilter, the system made N separate database calls (one per model).

After:

  • Now, if Components or Relationships is enabled in the ModelFilter, the function executes a single bulk query for all models, one query for components and one query for relationships regardless of the number of models.

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Souvik Kar Mahapatra <souvikat001@gmail.com>
Signed-off-by: Souvik Kar Mahapatra <souvikat001@gmail.com>
Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leecalcote
Copy link
Member

Will you please describe where this function is being used and how this bulk behavior improves performance?

@souvikinator
Copy link
Contributor Author

Yes, I'll do benchmarking and share it here.

@leecalcote
Copy link
Member

Yes, I'll do benchmarking and share it here.

@souvikinator that's not what I'm asking for.

What other parts of Meshery use this functionality? How have you confirmed that you've not broken those areas with this change?

What is driving this change? Is there an open issue describing this or calling for this PR?

@souvikinator
Copy link
Contributor Author

souvikinator commented Feb 21, 2025

@leecalcote
There is no open issue or this was not pointed out specifically. While I was exploring the current search logic for the registry model tab I noticed optimization opportunity and proceeded with it.

I went through all the occurrences of this h.registryManager.GetEntities with ModelFilter.
Found these endpoints using it:
GET /api/meshmodels/models
GET /api/meshmodels/models/{model}
GET /api/meshmodels/export
GET /api/meshmodels/categories/{category}/models

Went to each part in the dashboard where these are being called and compared it to the playground in the production.

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

Successfully merging this pull request may close these issues.

2 participants