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 queries to DB when collecting routing info #3813

Merged

Conversation

svkrieger
Copy link
Contributor

Thanks for contributing to cloud_controller_ng. To speed up the process of reviewing your pull request please provide us with:

  • A short explanation of the proposed change:
    Previously there were many DB queries when e.g. adding a destination to a route. There were as many queries as route_mappings existed for the process (destination). Further queries then fetched associated routes, domains and route_bindings each in their own query. With this change all those resources are fetched via eager loading, which results in one query per DB table, in this case 5.

  • Links to any other associated PRs

Implemented performance tests for adding a destination to an app with many route mappings: cloudfoundry/cf-performance-tests#34

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@svkrieger svkrieger force-pushed the improve-routing-info-collection branch from 44756c3 to 4bd0658 Compare May 27, 2024 13:29
kathap
kathap previously approved these changes May 28, 2024
Copy link
Contributor

@kathap kathap left a comment

Choose a reason for hiding this comment

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

LGTM

Previously there were many DB queries when e.g. adding a destination to a route.
There were as many queries as route_mappings existed for the process (destination).
Further queries then fetched associated routes, domains and route_bindings each in their own query.
With this change all those resources are fetched via eager loading, which results in one query per DB table, in this case 5.
@svkrieger svkrieger force-pushed the improve-routing-info-collection branch from 4bd0658 to 0dcba6f Compare May 31, 2024 08:38
Copy link
Contributor

@johha johha left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@svkrieger svkrieger merged commit 8e3a8f2 into cloudfoundry:main May 31, 2024
8 checks passed
@svkrieger svkrieger deleted the improve-routing-info-collection branch May 31, 2024 09:59
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.

4 participants