Cap Metro maxWorkers to leave host cores free for the device under test#152
Merged
Conversation
…able GitHub-hosted runners only have 2-4 cores, so an emulator claiming a device-profile default of 4 vCPUs oversubscribes the host alongside Metro and the Node test session during startup. Bake a fixed hw.cpu.ncore=2 into each AVD's config.ini (fixed, not host-derived, so snapshots stay portable across runner sizes), regenerate incompatible cached AVDs, roll the AVD cache key so old caches are replaced once, and add a non-fatal warning when KVM/HVF acceleration looks unavailable.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ed action Now that the action has a real dependency on platform-android for EMULATOR_CPU_CORES, drop the local copy of getHostAndroidSystemImageArch and import the original, which is behaviorally identical. The local resolveAvdCachingEnabled stays: it is intentionally simpler than the platform-android variant, which also gates on interactivity.
Share a 2-4 core guest allocation between Android AVD creation, compatibility checks, action cache keys, and Metro consumers. This preserves CI behavior while allowing larger development hosts to use four emulator vCPUs.
3bb0943 to
cfe7934
Compare
Describe the user-visible benefit of adaptive emulator CPU allocation.
GitHub-hosted CI runners are small (2-4 cores), and Metro's default maxWorkers formula can claim every host core for transform workers. The Android emulator is now pinned to 2 vCPUs and the iOS simulator runs as host processes, so leaving no headroom starves the device right when both are busiest, at startup. Reserve 2 host cores for the device and only ever lower Metro's resolved maxWorkers to respect that, never raise it. Also fixes a pre-existing @nx/dependency-checks lint failure in this package (missing "vite" from ignoredDependencies, unlike every sibling package's eslint config) that was blocking commits here.
Use the shared host-derived guest allocation so Metro reserves exactly the cores granted to the emulator. This retains 2-core CI behavior and restores a 4-core emulator budget on 8-core hosts.
Describe the user-visible startup responsiveness benefit.
cfe7934 to
3237156
Compare
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.
User impact
Harness test runs stay more responsive by balancing Metro work with the device under test, reducing slowdowns on larger development machines. Small CI runners behave as before.
Depends on #151; retarget to
mainafter it merges.