@@ -41,66 +41,74 @@ index 420014d..d8e45df 100644
4141 public function queueEmpty(): bool { return true; }
4242 }
4343diff --git a/base/PerfOptions.php b/base/PerfOptions.php
44- index add42c7..7603fdf 100644
44+ index add42c7..dfe40a6 100644
4545--- a/base/PerfOptions.php
4646+++ b/base/PerfOptions.php
47- @@ -58,6 +58,15 @@ final class PerfOptions {
47+ @@ -58,6 +58,17 @@ final class PerfOptions {
4848 public bool $noTimeLimit = false;
4949 public bool $runAsRoot = false;
5050
5151+ // Options for shortening the execution time
5252+ public bool $shortenHealthCheck = false;
5353+ public bool $skipSingleRequestWarmup = false;
5454+ public bool $skipSleepBetweenWarmups = false;
55+ + public bool $noLoadIfPendingTranslate = false;
5556+ public int $firstMultiWarmupDuration = 60;
5657+ public int $subseqMultiWarmupDuration = 10;
58+ + public int $loadGenSeed = 1000;
5759+ public int $numMultiReqWarmups = -1;
5860+
5961+
6062 // Pause once benchmarking is complete to allow for manual inspection of the
6163 // HHVM or PHP process.
6264 public bool $waitAtEnd = false;
63- @@ -105,6 +114 ,7 @@ final class PerfOptions {
65+ @@ -105,6 +116 ,7 @@ final class PerfOptions {
6466 public float $delayProcessLaunch; // secs to wait after start process
6567 public float $delayCheckHealth; // secs to wait before hit /check-health
6668
6769+
6870 //
6971 // Maximum wait times, as for example given to file_get_contents
7072 // or the configuration file for nginx. These times may be truncated
71- @@ -221,6 +231,12 @@ final class PerfOptions {
73+ @@ -221,6 +233,14 @@ final class PerfOptions {
7274 'memcached-threads:',
7375 'no-memcached', // do not use memcached (even if target supports it)
7476 'scale-out:',
7577+ 'shorten-health-check',
7678+ 'skip-single-request-warmup',
7779+ 'skip-sleep-between-warmups',
80+ + 'no-load-if-pending-translate',
7881+ 'first-multi-warmup-duration:',
7982+ 'subseq-multi-warmup-duration:',
83+ + 'load-gen-seed:',
8084+ 'num-multi-req-warmups:'
8185 };
8286 $targets = $this->getTargetDefinitions()->keys();
8387 $def->addAll($targets);
84- @@ -312,6 +328,14 @@ final class PerfOptions {
88+ @@ -312,6 +332,18 @@ final class PerfOptions {
8589 $this->applyPatches = $this->getBool('apply-patches');
8690 $this->useMemcached = !$this->getBool('no-memcached');
8791
8892+ $this->shortenHealthCheck = $this->getBool('shorten-health-check');
8993+ $this->skipSingleRequestWarmup = $this->getBool('skip-single-request-warmup');
9094+ $this->skipSleepBetweenWarmups = $this->getBool('skip-sleep-between-warmups');
95+ + $this->noLoadIfPendingTranslate = $this->getBool('no-load-if-pending-translate');
9196+ $this->firstMultiWarmupDuration = $this->getInt('first-multi-warmup-duration', 60);
9297+ $this->subseqMultiWarmupDuration = $this->getInt('subseq-multi-warmup-duration', 10);
98+ + $this->loadGenSeed = $this->getInt('load-gen-seed', 1000);
99+ +
100+ +
93101+ $this->numMultiReqWarmups = $this->getInt('num-multi-req-warmups', -1);
94102+
95103+
96104 $fraction = $this->getFloat('cpu-fraction', 1.0);
97105 if ($fraction !== 1.0) {
98106 $this->cpuBind = true;
99107diff --git a/base/PerfRunner.php b/base/PerfRunner.php
100- index 5201a2d..7c44632 100644
108+ index 5201a2d..478edd3 100644
101109--- a/base/PerfRunner.php
102110+++ b/base/PerfRunner.php
103- @@ -219,27 +219,53 @@ final class PerfRunner {
111+ @@ -219,27 +219,71 @@ final class PerfRunner {
104112 exec($options->scriptBeforeWarmup);
105113 }
106114
@@ -113,43 +121,61 @@ index 5201a2d..7c44632 100644
113121
114122 if (!$options->skipWarmUp) {
115123- self::RunLoadGenerator(RequestModes::WARMUP_MULTI, $options, $target, $engines);
116- + self::RunLoadGenerator(RequestModes::WARMUP_MULTI, $options, $target, $engines, $options->firstMultiWarmupDuration);
124+ + self::RunLoadGenerator(RequestModes::WARMUP_MULTI,
125+ + $options, $target, $engines, $options->firstMultiWarmupDuration);
117126 } else {
118127- self::PrintProgress('Skipping multi request warmup');
119128+ self::PrintProgress('Skipping first multi request warmup');
120- }
129+ + }
121130+ if ($options->numMultiReqWarmups >= 0){
122- + self::PrintProgress('Deterministic warmpup with '.($options->numMultiReqWarmups). ' iterations');
131+ + self::PrintProgress('Deterministic warmpup with '
132+ + .($options->numMultiReqWarmups). ' iterations');
123133+ for ($i = 0; $i < $options->numMultiReqWarmups; $i++){
124- + self::PrintProgress(' Performing '. ($i+1). 'th multi-request warmup iteration out of '.($options->numMultiReqWarmups). ' iterations');
134+ + self::PrintProgress(' Performing '. ($i+1)
135+ + .'th multi-request warmup iteration out of '
136+ + .($options->numMultiReqWarmups));
125137+ if (!$options->skipSleepBetweenWarmups){
126138+ sleep(3);
127139+ }
128- + self::RunLoadGenerator(RequestModes::WARMUP_MULTI, $options, $target, $engines, $options->subseqMultiWarmupDuration);
129- +
140+ + self::RunLoadGenerator(RequestModes::WARMUP_MULTI,
141+ + $options, $target, $engines, $options->subseqMultiWarmupDuration);
130142+ $status_message = null;
131143+ if (self::NeedsRetranslatePause($engines, inout $status_message)){
132- + self::PrintProgress('Server is not done warming up. Status: ' . ($status_message ?? 'Unknown'));
144+ + self::PrintProgress("Server is not done warming up.\n Status: "
145+ + .($status_message ?? 'Unknown'));
133146+ }else{
134147+ self::PrintProgress('Server is done warming up.');
135148+ }
136149+ }
137-
138- - while (!$options->skipWarmUp && self::NeedsRetranslatePause($engines)) {
139- - self::PrintProgress('Extending warmup, server is not done warming up.');
140- - sleep(3);
141- - self::RunLoadGenerator(RequestModes::WARMUP_MULTI, $options, $target, $engines, 10);
142- + }
150+ +
151+ }
143152+ else{
144153+ while (!$options->skipWarmUp) {
145154+ $status_message = null;
146155+ if (self::NeedsRetranslatePause($engines, inout $status_message)) {
147- + self::PrintProgress('Extending warmup, server is not done warming up. Status: ' . ($status_message ?? 'Unknown'));
156+ + self::PrintProgress("Extending warmup ... \n server is not done warming up. "
157+ + ."\n Status: " . ($status_message ?? 'Unknown'));
148158+ if (!$options->skipSleepBetweenWarmups){
149159+ sleep(3);
150160+ }
151- + self::RunLoadGenerator(RequestModes::WARMUP_MULTI, $options, $target, $engines, $options->subseqMultiWarmupDuration);
152- + } else {
161+ + # if $status_message contains Waiting on retranslateAll(),
162+ + # we might only need to wait a bit longer
163+ + if ($options->noLoadIfPendingTranslate &&
164+ + $status_message !== null &&
165+ + strpos($status_message, "Waiting on retranslateAll()") !== false){
166+ + self::PrintProgress('no new load if pending translate is set,
167+ + waiting for retranslateAll');
168+ + }else{
169+ + self::RunLoadGenerator(RequestModes::WARMUP_MULTI, $options, $target, $engines,
170+ + $options->subseqMultiWarmupDuration);
171+ + }
172+
173+ - while (!$options->skipWarmUp && self::NeedsRetranslatePause($engines)) {
174+ - self::PrintProgress('Extending warmup, server is not done warming up.');
175+ - sleep(3);
176+ - self::RunLoadGenerator(RequestModes::WARMUP_MULTI, $options, $target, $engines, 10);
177+ + }else {
178+ + self::PrintProgress('Server is done warming up');
153179+ break;
154180+ }
155181+ }
@@ -163,7 +189,7 @@ index 5201a2d..7c44632 100644
163189 sleep(10);
164190 }
165191
166- @@ -327,9 +353 ,9 @@ final class PerfRunner {
192+ @@ -327,9 +371 ,9 @@ final class PerfRunner {
167193 return $combined_stats;
168194 }
169195
0 commit comments