Experimental run-tests.php parallelisation (2019 rebase) - #3838
Experimental run-tests.php parallelisation (2019 rebase)#3838hikari-no-yume wants to merge 2 commits into
Conversation
|
@nikic said this on the previous PR:
Basically, but the other way round. It implements parallelisation on the directory level — to be precise, tests from the same directory will by default not be run concurrently — but uses marker files to opt in a particular directory to parallelisation on the file level.
This would be possible. It would be a bit more annoying to implement, though, because the current parallelisation approach doesn't require reading any test files, it batches everything at the finding-files step. |
|
There's a significant bottleneck in the current code that becomes obvious when handling file tests, where the all the worker processes get bottlenecked by the supervisor process, probably because it's waiting on one particular worker process (to write to it?). This is probably easily fixed by me being less lazy and making the code more non-blocking. |
Programmer thinking. I assumed that |
|
Same here - better use another leading symbol than something similar to a not-symbol :-D However, very nice and thanks for the patch. |
There was a problem hiding this comment.
Have you ever heard of the heredoc indentation improvements in PHP 7.3?
|
Can you please add |
|
Ahaha, I understand now. I used |
|
To put the meta files ( Maybe just a side note/recap (and I really don't want to stop this essential and important missing feature in progress). I find the Anyhow, thank you for working on this. :) |
There was a problem hiding this comment.
Why do we need to skip IO capture tests?
There was a problem hiding this comment.
The actual answer to this is “I wish I knew”. They behave completely incorrectly when parallelised testing is in use and for no obvious reason. I gave up trying to figure out why.
There was a problem hiding this comment.
Just double checked whether this is expected. From the stream_set_blocking documentation:
If mode is FALSE, the given stream will be switched to non-blocking mode, and if TRUE, it will be switched to blocking mode. This affects calls like fgets() and fread() that read from the stream. In non-blocking mode an fgets() call will always return right away while in blocking mode it will wait for data to become available on the stream.
Which makes sense, of course a non-blocking socket can't just wait until a full line is received.
There was a problem hiding this comment.
Though this also makes me think that you shouldn't be just looping over fgets() here. That should only be done if there's actually data available.
There was a problem hiding this comment.
That's what the stream_select is supposed to be for, I guess.
There was a problem hiding this comment.
I think it was something to do with redirections, but I don't remember exactly.
@hikari-no-yume The number we are supposed to pass to nprocin Linux and in macOS? |
|
@carusogabriel If that's what you'd pass to |
8319a3d to
24d5931
Compare
|
I renamed |
24d5931 to
f93556a
Compare
|
I added -j2 to Travis and AppVeyor. Based on the commit history from October 2017, I think I previously determined -j4 wasn't worthwhile for those. |
|
Timings from CI runs: Travis: 905s -> 587s There are also some test failures. On Travis it's some tests using the built-in server. My guess would be that this is due to the assumption that all directories can be run in parallel, but here likely many directories contain tests using the built-in server and some probably have overlapping ports. On AppVeyor there are also some multi-byte filesystem tests failing, not sure if that can be related to the parallelization (some kind of environment difference?) |
|
While this functionality isn't perfect yet, and not stable enough for use in CI, it seems to be reliable for Zend tests (aka the only important tests!), so I went ahead and applied the first commit via 39792f5. We can implement further improvements based on this... |
Careful rebase and slight cleanup of #2822. It had this internals thread: http://news.php.net/php.internals/100838
The short and sweet summary is that if you have an 8-core 16-thread CPU and do
run-tests.php -j16it will run… well, not quite 16x faster, but much closer to that than to the current speed. ^^Works on Windows and *nixen. Compatibility with all run-tests.php flags not guaranteed, but it's not on by default.