diff --git a/base/PerfRunner.php b/base/PerfRunner.php index cad8f1f..ea0c2de 100644 --- a/base/PerfRunner.php +++ b/base/PerfRunner.php @@ -139,6 +139,22 @@ private static function RunWithOptionsAndEngine( self::PrintProgress('Skipping multi request warmup'); } + while (!$options->skipWarmUp && $php_engine->needsRetranslatePause()) { + self::PrintProgress('Extending warmup, server is not done warming up.'); + sleep(3); + $siege = new Siege($options, $target, RequestModes::WARMUP_MULTI, '10s'); + $siege->start(); + invariant($siege->isRunning(), 'Failed to start siege'); + $siege->wait(); + + invariant(!$siege->isRunning(), 'Siege is still running :/'); + invariant( + $php_engine->isRunning(), + '%s crashed', + get_class($php_engine), + ); + } + self::PrintProgress('Clearing nginx access.log'); $nginx->clearAccessLog(); @@ -152,11 +168,6 @@ 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(); diff --git a/base/Siege.php b/base/Siege.php index d8ae674..924226a 100644 --- a/base/Siege.php +++ b/base/Siege.php @@ -18,6 +18,7 @@ public function __construct( private PerfOptions $options, private PerfTarget $target, private RequestMode $mode, + private string $time = '1M', ) { parent::__construct($options->siege); $this->suppress_stdout = true; @@ -134,7 +135,7 @@ protected function getArguments(): Vector { '-c', $this->options->clientThreads, '-t', - '1M', + $this->time, '-f', $urls_file, '--benchmark',