Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Extend warmup until HHVM reports that it is warmed up.
Browse files Browse the repository at this point in the history
  • Loading branch information
mofarrell committed Apr 5, 2017
1 parent fa84247 commit 97b74e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
21 changes: 16 additions & 5 deletions base/PerfRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion base/Siege.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -134,7 +135,7 @@ protected function getArguments(): Vector<string> {
'-c',
$this->options->clientThreads,
'-t',
'1M',
$this->time,
'-f',
$urls_file,
'--benchmark',
Expand Down

1 comment on commit 97b74e3

@octmoraru
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Please sign in to comment.