Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parallel limit #225

Merged
merged 5 commits into from Nov 8, 2018
Merged

Add parallel limit #225

merged 5 commits into from Nov 8, 2018

Conversation

OndraM
Copy link
Member

@OndraM OndraM commented Oct 26, 2018

Ref. #210, #153

Allow to define a parallel limit (by default 50) - the actual number of parallel processes started by Steward.

Current theory of operation was:

  1. start separate system process for each testace class (except those with delay)
  2. start PHPUnit in each process and let it connect to Selenium server
  3. use Selenium queue capabilities (ie. wait with open connection until Selenium session is created)
  4. run the test

But this started causing issues on large testsuites (with hundreds of tests), because, obviously, there has been running system process (consuming RAM, CPU) for each testcase, even if most of them were just queued and were just waiting for free slot. And with Selenium farm, which is capable of running many tests in a parallel, this could easily lead to uncontrolled resources exhausting.

The new theory operation is:

  1. start separate system process for testace class until parallel limit is reached
  2. any new process will be started only after some of the previously started processes finishes (and the number of parallel processes is below the limit)

Note the PR is still kind-of proof of concept, I expect some beta-testing of this branch (and maybe some code cleanup) before this will be merged to master.


protected function parallelLimitReached(): bool
{
return count($this->processSet->get(ProcessWrapper::PROCESS_STATUS_PREPARED)) >= $this->parallelLimit;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is strange, isn`t it?

How current number of processes be greater than limit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is parallelism, who knows what could happen 🤣 . I prefer being a bit defensive there.

src/Process/ExecutionLoop.php Outdated Show resolved Hide resolved
src/Process/ExecutionLoop.php Outdated Show resolved Hide resolved
src/Process/ExecutionLoop.php Show resolved Hide resolved
@OndraM OndraM force-pushed the feature/parallel-limit branch 3 times, most recently from 12227c8 to 2df6ad9 Compare November 1, 2018 11:58
@OndraM OndraM merged commit e8ba1dd into master Nov 8, 2018
@OndraM OndraM deleted the feature/parallel-limit branch November 26, 2020 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants