Skip to content

Make static graph restore the default experience. #9803

Open

Description

@nkolev92

This is an epic tracking all things relevant to static graph restore and whether there are any blockers/concerns to making it the default.

For readers, you'll need Zenhub to see the linked issues.

Currently this contains all potential issues tagged as static graph.

This doesn't mean they all need to be fixed, just analyzed :)

Note

For customers moving to static graph

  • If you want to ensure that your restore is equivalent across static graph and regular restore consider running:
  1. Restore with static graph.
  2. Restore without static graph

When you run this, at the end of the second restore you should see something like:
All projects are up-to-date for restore.

Relevant issues: https://github.com/NuGet/Home/issues?q=state%3Aopen%20label%3A%22Area%3ARestoreStaticGraph%22.

Another consideration would be dotnet run performance. The new process start-up for no-op can be pretty costly 0.5s, so making static graph perform similarly to regular no-op would be a consideration.

Activity

  1. added
    Area:RestoreRepeatableBuild
    Area:RestoreStaticGraph
    Tenet:Performance
    Priority:2
    and removed
    Area:RestoreRepeatableBuild
    on Jul 15, 2020
  2. changed the title [-]Progress on making static graph restore the default experience.[/-] [+]Make static graph restore the default experience.[/+] on Jul 16, 2020
  3. jeffkl commented on Jul 16, 2020

    @jeffkl
    Contributor

    One potential issue is that static graph evaluation based restore doesn't call any of the older targets like _GenerateRestoreProjectPathItemsPerFramework. People shouldn't be using them as extension points since we prefixed them with _ but there's no enforcement. So if the default switches, these targets won't run any more and people's builds can start failing in very weird ways.

    Telemetry would help us greatly here to know how many people are doing this. We might even be able to add a warning in a future release telling people that the targets are going away.

  4. nkolev92 commented on Jul 16, 2020

    @nkolev92
    MemberAuthor

    That's a great point.
    Definitely a smaller concern, but a possibility.

    Think advertising the existence of the feature more broadly before making it a default is a good idea.

    1ES repos will probably catch a large majority of the scenarios, but you can never have too many dogfooders :)

  5. jeffkl commented on Jul 16, 2020

    @jeffkl
    Contributor

    We are spinning up automation to make it the default for all 1ES customers by sending PRs to their repos. I'll update this issue with the problems we have getting people to adopt it.

  6. 4 remaining items

  7. nkolev92 commented on Sep 11, 2020

    @nkolev92
    MemberAuthor

    @aolszowka The dup of the issue you linked in tracked here.

  8. nkolev92 commented on Sep 11, 2020

    @nkolev92
    MemberAuthor

    Oh @jeffkl is already on it!

  9. nkolev92 commented on Oct 27, 2020

    @nkolev92
    MemberAuthor

    I have updated the issue body calling out the way to test for the equivalence of these 2 experiences.

    If you see a problem, do let us know by filling an issue.

  10. aolszowka commented on Nov 19, 2020

    @aolszowka

    What was the status on dog-fooding this? I can't believe we're this unique to have two issues found by just us #10307

  11. Piedone commented on Aug 13, 2022

    @Piedone

    I've made some performance measurements, locally and under GitHub Actions (Ubuntu and Windows) with our Lombiq's Open-Source Orchard Core Extensions solution. This, since it uses Orchard Core, has hundreds of package dependencies with transitive ones included.

    You can find my results here. I've seen some nice 8-15% speedups locally during dotnet restore. In GitHub Actions builds I was more interested in the overall impact on the dotnet build times (usually we don't have a separate restore) and while it does show up as a 0,5-4,5% speedup there too with an empty NuGet cache (what happens with GHA builds due to their fresh VMs, unlike local ones), the 3,5% slowdown for the full source Windows builds (which is the slowest) cancels out the aggregate compute time gains (and adds time waiting for the workflow to finish).

    Could you check it out, please? It seems that turning this on doesn't help in the GHA case all in all. Though the margins we're talking about here are really small, so probably doing more measurements would turn the end result somewhat.

  12. jeffkl commented on Aug 17, 2022

    @jeffkl
    Contributor

    @Piedone thanks for the detailed performance measurements. During a full restore, I would not necessarily expect static graph-based restore to be too much faster. The main optimization that static graph-based restore uses is an out-of-proc system for evaluating all of the MSBuild projects which uses some special feature flags to improve performance as well as server GC. Once the projects have been evaluated, the same code runs to execute restore for both "regular" and static graph-based restore.

    The more projects a repository has, the more I would expect static graph-based restore to speed things up. And of course no-op restores benefit the most since evaluating all of the MSBuild projects is the long pole and no packages are pulled and unzipped. For example, we have an internal repo with 750 projects where a full no-op restore used to take 35 seconds but now takes only 7 seconds. We also have a repository with 5,000 projects that would basically time out when restoring but now can restore in a few minutes.

    We'll continue to improve restore performance in both scenarios and see if we can ever make static graph-based restore the default. But for now it will remain opt-in based on each individual repositories needs.

  13. Piedone commented on Aug 17, 2022

    @Piedone

    I see, thanks for the explanation!

  14. ghost added
    missing-required-type
    on Sep 2, 2022
  15. added
    Type:DCR
    on Sep 5, 2022
  16. ghost removed
    missing-required-type
    on Sep 5, 2022
  17. stan-sz commented on Feb 24, 2023

    @stan-sz

    Just in case, linking dotnet/msbuild#8326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area:RestoreStaticGraphFunctionality:RestorePartner:MSBuildPriority:2Product:dotnet.exeTenet:PerformanceType:DCR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions