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

Adding command line parameter to specify the number of HHVM Server Th… #80

Merged
merged 9 commits into from
Mar 22, 2017
1 change: 1 addition & 0 deletions base/HHVMDaemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ protected function getArguments(): Vector<string> {
if (count($this->options->hhvmExtraArguments) > 0) {
$args->addAll($this->options->hhvmExtraArguments);
}
$args->add('-dhhvm.server.thread_count='.$this->options->serverThreads);
if ($this->options->precompile) {
$bcRepo = $this->options->tempDir.'/hhvm.hhbc';
$args->add('-v');
Expand Down
14 changes: 13 additions & 1 deletion base/PerfOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ final class PerfOptions {
public ?string $scriptBeforeWarmup;
public ?string $scriptAfterWarmup;
public ?string $scriptAfterBenchmark;
public ?string $serverThreads = '100';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this not be optionally null? You set a default here, so it should never be null.

public ?string $clientThreads;

public bool $notBenchmarking = false;

Expand Down Expand Up @@ -166,6 +168,8 @@ public function __construct(Vector<string> $argv) {
'daemon-files', // daemon output goes to files in the temp directory
'temp-dir:', // temp directory to use; if absent one in /tmp is made
'src-dir:', // location for source to copy into tmp dir instead of ZIP
'server-threads:',
'client-threads:',
};
$targets = $this->getTargetDefinitions()->keys();
$def->addAll($targets);
Expand Down Expand Up @@ -291,7 +295,16 @@ public function __construct(Vector<string> $argv) {
$this->daemonOutputToFile = $this->getBool('daemon-files');

$argTempDir = $this->getNullableString('temp-dir');

if(array_key_exists('server-threads', $o)){
$this->serverThreads = $this->args['server-threads'];
}

if(array_key_exists('client-threads', $o)){
Copy link
Contributor

Choose a reason for hiding this comment

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

This also needs a default.

$this->clientThreads = $this->args['client-threads'];
PerfSettings::setBenchmarkConcurrency((int)$this->clientThreads);
}

if ($argTempDir === null) {
$this->tempDir = tempnam('/tmp', 'hhvm-nginx');
// Currently a file - change to a dir
Expand All @@ -302,7 +315,6 @@ public function __construct(Vector<string> $argv) {
}

$this->srcDir = $this->getNullableString('src-dir');

}

public function validate() {
Expand Down
7 changes: 6 additions & 1 deletion base/PerfSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
final class PerfSettings {

///// Benchmark Settings /////
private static int $benchmarkConcurrency = 200;

// Per concurrent thread - so, total number of requests made during warmup
// is WarmupRequests * WarmupConcurrency
Expand All @@ -28,8 +29,12 @@ public static function BenchmarkTime(): string {
return '1M'; // 1 minute
}

public static function setBenchmarkConcurrency(int $toSet): void {
PerfSettings::$benchmarkConcurrency = $toSet;
}

public static function BenchmarkConcurrency(): int {
return 200;
return PerfSettings::$benchmarkConcurrency;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we actually remove benchmark concurrency settings here, and use the options instead in base/Siege.php? (So basically just make it similar to the way the serverThreads option works)
I think it will end up cleaner.

}

///// Server Settings /////
Expand Down
3 changes: 0 additions & 3 deletions conf/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ assert.active=false
;;;;;;;;;;;;;
; HHVM Only ;
;;;;;;;;;;;;;
; HHVM's default is 2*CPU cores; this works reasonably well if you're using
; HHVM's async features, however it's way too low for most other loads.
hhvm.server.thread_count=100
; This is a no-op on production builds, but makes it possible to get meaningful
; profiles from debug builds
hhvm.hhir_generate_asserts=0
Expand Down