Repository navigation
Cut local API generation from about 3 minutes to 45 seconds - #4980
Merged
Merged
Conversation
API generation renders every version tree on all cores and allocates heavily. Workstation GC collects on one heap, so the render threads stalled on it. On an 18-core machine the first `/api/` request of `serve` took 142 to 203 s and now takes 40 to 49 s. The dev container set `DOTNET_gcServer` for the same reason. It runs the Debug build, so the project setting replaces the variable. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
|
||
| <!-- API generation allocates from every core at once. Workstation GC collects on one heap and made it 4x slower. --> | ||
| <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> | ||
| <ServerGarbageCollection>true</ServerGarbageCollection> |
There was a problem hiding this comment.
Severity: P3 (Low)
Add a build smoke check that verifies System.GC.Server is enabled in the generated Debug runtime config and not enabled in Release. Now that Compose no longer sets GC mode, a regression in this property could bring back the slow first API request while builds and functional tests still pass.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4980/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Debug builds of
docs-buildernow run with server GC. On an 18-core machine the first/api/request ofservedrops from 142 to 203 s to 40 to 49 s.Affects: API reference, Deploys & previews
Prompt summary: The author asks why API generation takes 3 minutes and whether it can be faster. The goal is a shorter wait on the first API page of a local
serve.Why
API generation renders every version tree on all cores and allocates heavily. Debug builds ran workstation GC, which collects on one heap. The render threads stalled on that collector, so the process used about 4 of 18 cores. Only the dev container avoided this, through a
DOTNET_gcServervariable.What
Server GC for Debug builds
Every local entry point now gets server GC:
mise run serve,mise run watch, the journeys tasks and a plaindotnet run. The setting lives indocs-builder.csprojand applies to theDebugconfiguration only. Release and AOT builds are unchanged.One place for the setting
The dev container runs the Debug build, so the project setting covers it. The
DOTNET_gcServervariable inbuild/dev/docker-compose.ymlis gone.Measurements
Each row is the first
/api/elasticsearch/request of a freshserveon an 18-core machine, with 22 version trees.Verify
The runtime configuration of the build shows the setting:
grep "System.GC.Server" .artifacts/bin/docs-builder/debug/docs-builder.runtimeconfig.jsonRisk The
assembler-preview.ymlanddocs-preview-local.ymlworkflows run a Debug build, so they pick up server GC. The run limited to 4 cores used less memory than before, but no GitHub runner was measured.Out of scope Release and AOT builds keep workstation GC. One Release run went from 101 s to 38 s with server GC, so the same setting is a candidate there once runner memory is measured.
🤖 Generated with Claude Code