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

Overridable revision fetching #124

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

Conversation

vitch
Copy link
Contributor

@vitch vitch commented Jul 8, 2022

What Changed & Why

Based on conversation in #121, this PR introduces an alternative approach to allowing consumers to optimise list operations on S3.
I'm currently integrating it in to our monorepo but thought I'd chuck this up for feedback first...

Related issues

#121
The changes from #123 are also shown on this branch but should be reviewed separately over there (not sure how to point a GH PR at a branch on a fork without it trying to merge into that fork?)

PR Checklist

  • Add tests (I can do this later if we think this is a good direction)
  • Add documentation
  • Prefix documentation-only commits with [DOC]

People

All maintainers

vitch and others added 4 commits July 8, 2022 23:35
There is no need to try and figure out if a revision has already been deployed
if we are going to overwrite it anyway. Let's save ourselves the network request!
There are cases where we might want to page through the list of objects available
on S3 but we don't need to keep going once we've found what we are looking for.
This commit updates `listAllObjects` to accept an `until` argument - if this
is provided then when a new page of results is loaded we check if `some` of them
match the `until` - if so we don't bother loading another page.

A concrete use-case for this is in ember-cli-deploy#120 - sometimes we just want to
find the currently active revision so we only need to loop through the "pages"
on S3 until we do.
…config

So that they can be overridden by call sites who are looking to optimise performance
(listing revisions from S3 can be expensive - especially so when you have many
deployments deployed)
@lukemelia
Copy link
Contributor

I like it. Let's see if it solves your problem well, and then we can move ahead with this if so.

@vitch
Copy link
Contributor Author

vitch commented Jul 22, 2022

We've been running this branch for a while now and have seen the following:

  • Average deploy time down to 6.1 minutes from 10.3 minutes (for apps with a lot of history this is even more extreme!)
  • Average activation time down from 7.3 minutes to 2.1 minutes (again, depending on the amount of history for the app)

With the following config:

{
  fetchInitialRevisionsFunc(/* context */) {
    return () => ({ initialRevisions: [] });
  },
  fetchRevisionsFunc(/* context */) {
    return () => ({ revisions: [] });
  },
}

We already stored a separate audit log entry in s3 which we are able to grab in order to solve the "what was the previously activated revision" use case.

We apply the config above based on an environment variable and only set that variable when calling ember deploy or ember deploy:activate from CI (so that ember deploy:list still works).

Given the results above I'll try to add some tests to this branch and aim for it to be mergeable?

@lukemelia
Copy link
Contributor

Sounds good. Thanks for the update @vitch, and glad it is performing well for you!

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