Skip to content

Adaptive parallelism: limit parallel tests by projected memory use, before memory pressure appears #7896

Backlog

Description

@thomhurst

Summary

With --adaptive-parallelism, the parallel test limit comes down for memory only after the machine is already nearly out of memory (95% in use). Tests that each start a large process, such as a headed browser at about 4 GiB per test, can exhaust memory before the limit reacts. Such suites still need a fixed --maximum-parallel-tests, which is what adaptive parallelism is meant to make unnecessary.

Proposal

Estimate the memory one running test uses (the change in memory in use divided by the change in running tests, measured as the limit moves or as tests start), and do not admit more tests than the available memory can hold at that estimate. The limit would then stop rising before pressure appears, instead of halving after it.

Open point

Whether --adaptive-min-parallel-tests 1, added in 1.88.2, already reacts fast enough for these suites has not been tested. A run of a memory-heavy suite with that setting would show whether this is needed.

Environment

TUnit 1.88.2.

Activity

  1. added
    enhancement
    on Nov 29, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions