Skip to content

Test parallellization uses a stupid strategy #20980

Open

Description

@ndossche

Description

When running ./run-test.php with the -j argument, all the tests are scheduled to the workers before even running them. This means that if you have a worker which finishes all its tests quickly it'll sit idle even if there are many more other tests to run. One can observe this often because at the end of a test run the number of concurrent working test runners drops quickly.

PHP Version

8.4+

Operating System

N/A

Activity

  1. iluuu1994 commented on Jan 20, 2026

    @iluuu1994
    Member

    Another dumb thing that has bitten me before: When running tests without -j, tests are printed to the console before they are executed (without --no-progress). With -j, they are printed after.

    One can observe this often because at the end of a test run the number of concurrent working test runners drops quickly.

    One note though is that many of the last tests are marked as CONFLICTS: all. So they are intentionally unparallelized.

  2. ndossche commented on Jan 20, 2026

    @ndossche
    MemberAuthor

    One note though is that many of the last tests are marked as CONFLICTS: all. So they are intentionally unparallelized.

    Yes. I was in particular looking at the OpenSSL tests, which has a CONFLICTS file but does no longer seem necessary, after removing that the number of concurrent workers still drop pretty quickly.

  3. arnaud-lb commented on Feb 6, 2026

    @arnaud-lb
    Member

    Apparently we send work by batches of 33 tests. Slow tests happen to be grouped together, like the lstat variation ones, so if a worker receives a batch of those tests it will take more time to complete.

    On my machine, all workers are busy for about 10 seconds, then only 2-3 workers for about the same time, and then sequential tests run for about 4 seconds.

    Reducing batch size to 1 doesn't reduce total time due to communication overhead. I've also tried using batch sizes of min(33, #remainingTests/#workers), but no improvements either.

    Using --shuffle reduces the total time by about 30%.

  4. added a commit that references this issue on Jul 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions