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

[prebuilds] Automatically disable prebuilds for projects without active Workspace usage #8911

Closed
easyCZ opened this issue Mar 21, 2022 · 7 comments · Fixed by #9219
Closed
Assignees
Labels
team: webapp Issue belongs to the WebApp team

Comments

@easyCZ
Copy link
Member

easyCZ commented Mar 21, 2022

Is your feature request related to a problem? Please describe

In some instances, users configure Gitpod for a repository but do not actively start workspaces to develop in Gitpod.

Because of our prebuilds - optimization to get you to run workspaces faster, we continue to react to pushes to the repository and create prebuilds. However, these prebuilds are not useful as the users do not actively use gitpod to develop these.

In this scenario, we should consider reduce the number of prebuilds triggered from these repositories. Some options for doing this:

  • disable prebuilds entirely if no workpsace started in the last 7 days
  • Limit prebuilds to main only (and once a day) if no workspace started in 7 days

With this change, we need to strike the balance of convenience for the user and fairness in a multi-tenant system.

Originally raised by @kylos101.

@easyCZ easyCZ added the team: webapp Issue belongs to the WebApp team label Mar 21, 2022
@jankeromnes
Copy link
Contributor

jankeromnes commented Mar 21, 2022

Many thanks @easyCZ for filing this issue! 💯 I'm very much in favour of this.

if no workpsace started in the last 7 days

  • I wonder if 7 days is maybe a bit too short as a checking period (e.g. imagine a project with just a few developers, and they all happen to take a week of holidays at the same time -- disabling their prebuilds might be a bit too disruptive). How about 3 months?

  • Also, I wonder whether it makes sense to check for "did any workspace start for this project", or if we should more precisely look at "did any of the prebuilds get used as a base or a workspace" (somewhat similar, but I'd argue we're looking precisely for prebuilds that are 100% unused here -- although, looking for projects that are 100% unused could also be interesting, e.g. if we want to garbage collect projects one day? 🤔)


As for a technical approach, I guess we could implement a uninstallAutomatedPrebuilds method in RepositoryService, similar to:

async installAutomatedPrebuilds(user: User, cloneUrl: string): Promise<void> {

Then, I think we could possibly add another method to our GarbageCollector, that checks for projects (cloneURLs) which have prebuilds in the past 3 months, but none of these recent prebuilds were actually used to start a workspace, then just disable prebuilds for that project.

public async garbageCollectWorkspacesIfLeader() {
if (await this.leaderQuorum.areWeLeader()) {
log.info("wsgc: we're leading the quorum. Collecting old workspaces");
this.softDeleteOldWorkspaces().catch((err) => log.error("wsgc: error during soft-deletion", err));
this.deleteWorkspaceContentAfterRetentionPeriod().catch((err) =>
log.error("wsgc: error during content deletion", err),
);
this.deleteOldPrebuilds().catch((err) => log.error("wsgc: error during prebuild deletion", err));
}
}

@jankeromnes
Copy link
Contributor

See also research issue (internal)

@kylos101
Copy link
Contributor

@jankeromnes @easyCZ Another dimension to consider is tuning how aggressively we stop doing prebuilds based on the plan for the user. For example, we might want to be clean-up more aggressively for free plans, but, less aggressively with pay plans.

@kylos101
Copy link
Contributor

@atduarte for awareness

@kylos101
Copy link
Contributor

kylos101 commented Apr 8, 2022

@easyCZ I seem to recall this (or something like it) being socialized recently, and just wanted to bump this issue for awareness. 👋 Hope you're well!

@jankeromnes
Copy link
Contributor

jankeromnes commented Apr 11, 2022

Spontaneously jumping on this issue, as it seems important and compelling. 😁

EDIT: See also internal thread discussing implementation of a fix.

@jankeromnes jankeromnes moved this to Scheduled in 🍎 WebApp Team Apr 11, 2022
@jankeromnes jankeromnes self-assigned this Apr 11, 2022
@jankeromnes jankeromnes moved this from Scheduled to In Progress in 🍎 WebApp Team Apr 11, 2022
jankeromnes added a commit that referenced this issue Apr 12, 2022
Repository owner moved this from In Progress to Done in 🍎 WebApp Team Apr 12, 2022
roboquat pushed a commit that referenced this issue Apr 12, 2022
jankeromnes added a commit that referenced this issue Apr 13, 2022
@kylos101
Copy link
Contributor

Thank you, @jankeromnes ! 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team: webapp Issue belongs to the WebApp team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants