From fa84247bbd28d34e030552982e70415c8e337f18 Mon Sep 17 00:00:00 2001 From: Michael O'Farrell Date: Mon, 3 Apr 2017 10:09:57 -0700 Subject: [PATCH] Add pause to wait for end of warmup. Useful as retranslateAll can run long. Also switched options passed to HHVM to be compatible with HHVM 3.0 --- base/HHVMDaemon.php | 14 ++++++++++---- base/PHPEngine.php | 2 ++ base/PerfRunner.php | 5 +++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/base/HHVMDaemon.php b/base/HHVMDaemon.php index 3a354d6..169198d 100644 --- a/base/HHVMDaemon.php +++ b/base/HHVMDaemon.php @@ -62,6 +62,12 @@ protected function getTarget(): PerfTarget { return $this->target; } + <<__Override>> + public function needsRetranslatePause(): bool { + $status = $this->adminRequest('/warmup-status'); + return $status !== '' && $status !== 'failure'; + } + <<__Override>> protected function getArguments(): Vector { if ($this->options->cpuBind) { @@ -82,10 +88,10 @@ protected function getArguments(): Vector { 'Server.ErrorDocument404=index.php', '-v', 'Server.SourceRoot='.$this->target->getSourceRoot(), - '-d', - 'hhvm.log.file='.$this->options->tempDir.'/hhvm_error.log', - '-d', - 'pid='.escapeshellarg($this->getPidFilePath()), + '-v', + 'Log.File='.$this->options->tempDir.'/hhvm_error.log', + '-v', + 'PidFile='.escapeshellarg($this->getPidFilePath()), '-c', OSS_PERFORMANCE_ROOT.'/conf/php.ini', }; diff --git a/base/PHPEngine.php b/base/PHPEngine.php index a0d21e5..3687841 100644 --- a/base/PHPEngine.php +++ b/base/PHPEngine.php @@ -12,4 +12,6 @@ abstract class PHPEngine extends Process { public abstract function __toString(): string; public function writeStats(): void {} + + public function needsRetranslatePause(): bool { return false; } } diff --git a/base/PerfRunner.php b/base/PerfRunner.php index 1aed7ba..cad8f1f 100644 --- a/base/PerfRunner.php +++ b/base/PerfRunner.php @@ -152,6 +152,11 @@ private static function RunWithOptionsAndEngine( exec($options->scriptAfterWarmup); } + while ($php_engine->needsRetranslatePause()) { + self::PrintProgress('Pausing 5 seconds to allow retranslation threads to catch up.'); + sleep(5); + } + self::PrintProgress('Starting Siege for benchmark'); $siege = new Siege($options, $target, RequestModes::BENCHMARK); $siege->start();