bug #11120 [2.3][Process] Reduce I/O load on Windows platform (romainneutron)
This PR was merged into the 2.3 branch.
Discussion
----------
[2.3][Process] Reduce I/O load on Windows platform
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
When using file handles, no `stream_select` call is done.
On linux platforms, `stream_select` introduce a sleep as it has 0.2s timeout, there is no such pause on Windows, producing lot's of disk I/Os when reading file handles
Commits
-------
ff0bb01
[Process] Reduce I/O load on Windows platform
This commit is contained in:
commit
4dbe0e1c34
@ -284,6 +284,8 @@ class ProcessPipes
|
|||||||
private function readStreams($blocking, $close = false)
|
private function readStreams($blocking, $close = false)
|
||||||
{
|
{
|
||||||
if (empty($this->pipes)) {
|
if (empty($this->pipes)) {
|
||||||
|
usleep(Process::TIMEOUT_PRECISION * 1E4);
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -596,7 +596,14 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
$duration = microtime(true) - $start;
|
$duration = microtime(true) - $start;
|
||||||
|
|
||||||
$this->assertLessThan($timeout + Process::TIMEOUT_PRECISION, $duration);
|
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||||
|
// Windows is a bit slower as it read file handles, then allow twice the precision
|
||||||
|
$maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION;
|
||||||
|
} else {
|
||||||
|
$maxDuration = $timeout + Process::TIMEOUT_PRECISION;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertLessThan($maxDuration, $duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCheckTimeoutOnNonStartedProcess()
|
public function testCheckTimeoutOnNonStartedProcess()
|
||||||
|
Reference in New Issue
Block a user