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

Fix performance for porter list #2096

Merged
merged 7 commits into from
May 31, 2022
Merged

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented May 24, 2022

What does this change

Do not retrieve the full installation definition for each installation returned from list. We only need that information
for the show command. Right now porter is making multiple calls to both the storage and secrets plugin for each installation in the list results.

What issue does it fix

Closes #2040

Notes for the reviewer

Here is what the trace looks like with this fix (compared to the original trace which was huge)

Screen Shot 2022-05-24 at 3 01 32 PM

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

carolynvs added 2 commits May 24, 2022 15:17
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Do not retrieve the full installatin definition for each
installation returned from list. We only need that information
for the show command.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
if err != nil {
return err
}
di := NewDisplayInstallation(installation)
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the conversion of installations to display installations so that we could test these functions. In other parts of Porter we do the same thing but I guess this function is old enough it was doing the conversion in the print function still.

@carolynvs carolynvs marked this pull request as ready for review May 24, 2022 20:22
@carolynvs carolynvs requested a review from VinozzZ May 25, 2022 04:20
if err != nil {
return err
return nil, errors.Wrap(err, "could not list installations")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to trace the error here?

return DisplayInstallation{}, err
}

func (p *Porter) NewDisplayInstallationWithSecrets(ctx context.Context, installation storage.Installation, run *storage.Run) (DisplayInstallation, error) {
bun := cnab.ExtendedBundle{run.Bundle}
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the run is nil here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Haha you caught that at the same time I did, I was fixing that right before our meeting this morning. I just pushed it up now.

carolynvs added 3 commits May 25, 2022 11:06
It's possible for an installation record to be created but the bundle
isn't run before porter show is called.

I've fixed how we put together a DisplayInstallation to account for
that. Otherwise that code is returning a nil pointer exception.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs
Copy link
Member Author

@VinozzZ Okay I think I've fixed everything, please take another look!

@carolynvs carolynvs merged commit 539645a into getporter:release/v1 May 31, 2022
@carolynvs carolynvs deleted the cleanup-list branch May 31, 2022 13:58
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