playwright
playwright copied to clipboard
[Feature] Allow percentage values for number of workers
As has been recently discussed on the Playwright Slack, running PW tests with the default number of workers (8 on a CPU with 8 physical cores and 16 logical cores) is not stable with a growing testsuite (in our case 37 test cases, another user reported the same with 50 test cases), test execution slows down considerably and leads to fails due to teardown timeouts.
Limiting the number of workers to 4 alleviates this, the tests run stable and don't timeout.
workers: process.env.CI ? 1 : 4,
However, it would be better to be able to set this as a percentage value, so it would be flexible and use the proper amount of workers depending on the machine's hardware.
Currently the setting only accepts integer values.
Also here's an article that was shared on the PW Slack with some interesting findings relating to this topic: https://ivantanev.com/make-jest-faster/
Hi! I will work on it.
Awesome, thank you!
Hi there. I'm looking for your feedback on phrasing. What do you think ?
Here is what I'd like to add in docs :
The maximum number of concurrent worker processes to use for parallelizing tests. Can also be set as percentage of logical CPU cores. e.g. '50%'
And in the CLI help :
-j, --workers
Sounds good to me!
Just some minor suggestions:
- change
default: number of CPU cores / 2
todefault: number of logical CPU cores / 2
-
config workers doc currently says
Defaults to one half of the number of CPU cores.
, I would suggest also changing that toDefaults to half of the number of logical CPU cores.
- CLI help: change
Can be percentage percentage of logical CPU cores, for example "50%"
toCan be percentage of logical CPU cores, for example "50%"