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

Add --skip-warmup so the full load can be done immediately. #36

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions base/PerfOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ final class PerfOptions {
public string $nginx;

public bool $skipSanityCheck = false;
public bool $skipWarmUp = false;
public bool $skipVersionChecks = false;
public bool $skipDatabaseInstall = false;
public bool $dumpIsCompressed = true;
Expand Down Expand Up @@ -144,6 +145,7 @@ public function __construct(Vector<string> $argv) {
'no-time-limit',

'skip-sanity-check',
'skip-warmup',
'skip-version-checks',
'skip-database-install',
'trace',
Expand Down Expand Up @@ -216,6 +218,7 @@ public function __construct(Vector<string> $argv) {
$this->args = $o;

$this->skipSanityCheck = $this->getBool('skip-sanity-check');
$this->skipWarmUp = $this->getBool('skip-warmup');
$this->skipVersionChecks = $this->getBool('skip-version-checks');
$this->skipDatabaseInstall = $this->getBool('skip-database-install');
$this->noTimeLimit = $this->getBool('no-time-limit');
Expand Down
40 changes: 24 additions & 16 deletions base/PerfRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,36 @@ private static function RunWithOptionsAndEngine(
$target->sanityCheck();
}

self::PrintProgress('Starting Siege for single request warmup');
$siege = new Siege($options, $target, RequestModes::WARMUP);
$siege->start();
invariant($siege->isRunning(), 'Failed to start siege');
$siege->wait();
if (!$options->skipWarmUp) {
self::PrintProgress('Starting Siege for single request warmup');
$siege = new Siege($options, $target, RequestModes::WARMUP);
$siege->start();
invariant($siege->isRunning(), 'Failed to start siege');
$siege->wait();

invariant(!$siege->isRunning(), 'Siege is still running :/');
invariant($php_engine->isRunning(), get_class($php_engine).' crashed');
} else {
self::PrintProgress('Skipping single request warmup');
}

invariant(!$siege->isRunning(), 'Siege is still running :/');
invariant($php_engine->isRunning(), get_class($php_engine).' crashed');
if (!$options->skipWarmUp) {
self::PrintProgress('Starting Siege for multi request warmup');
$siege = new Siege($options, $target, RequestModes::WARMUP_MULTI);
$siege->start();
invariant($siege->isRunning(), 'Failed to start siege');
$siege->wait();

self::PrintProgress('Starting Siege for multi request warmup');
$siege = new Siege($options, $target, RequestModes::WARMUP_MULTI);
$siege->start();
invariant($siege->isRunning(), 'Failed to start siege');
$siege->wait();

invariant(!$siege->isRunning(), 'Siege is still running :/');
invariant($php_engine->isRunning(), get_class($php_engine).' crashed');
invariant(!$siege->isRunning(), 'Siege is still running :/');
invariant($php_engine->isRunning(), get_class($php_engine).' crashed');
} else {
self::PrintProgress('Skipping multi request warmup');
}

self::PrintProgress('Clearing nginx access.log');
$nginx->clearAccessLog();

self::PrintProgress('Running Siege for benchmark');
self::PrintProgress('Starting Siege for benchmark');
$siege = new Siege($options, $target, RequestModes::BENCHMARK);
$siege->start();
invariant($siege->isRunning(), 'Siege failed to start');
Expand Down