Rayrun
← Back to Discord Forum

Maximum Number of Workers

.masoodahmedposted in #help-playwright
Open in Discord
.masoodahmed
.masoodahmed

I am curious regarding how many maximum workers can we run on a given machine. For example, I have Mac M1 which as 8 CPU cores and 16 threads, so the number of workers that we can potentially run without slowing down the test cases is 8 (dependent on the CPU cores) or 16 (dependent on the threads) or is there a limit to maximum numbers of workers which I can use. Moreover, is there any shorter way or a script that we can run to find the optimum number of workers we can run. Previously, I was using the following command to find the best time for my test cases:

for i in seq <min> <max>; do time npx playwright test --reporter=line --workers=$i; done

Where <min> to be your # of CPU cores divided by 2, and <max> to be # of CPU cores times 2.

Can somebody help me visualize this as well by creating a plot between workers and system resources?

Thank You So Much!

This thread is trying to answer question "What is the maximum number of workers that can be run on a given machine, and how to find the optimum number of workers? Is the number of workers dependent on CPU cores or threads, and is there a limit to the maximum number of workers?"

4 replies

You should run the tests 10+ times with a given number of workers and take the mean or ~p80 duration.

.masoodahmed
.masoodahmed

Yeah I understand that, but I was wondering, on what specific system resource are workers dependent ? Is it CPU Cores?

https://playwright.dev/docs/api/class-testconfig#test-config-workers says "Defaults to half of the number of logical CPU cores"

.masoodahmed
.masoodahmed

Thank You

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].