Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Open
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
8 changes: 7 additions & 1 deletion base/PHP5Daemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,14 @@ protected function getArguments(): Vector<string> {
PerfSettings::BackendPort(),
$config
);
$config = str_replace(
"__BACKLOG__",
(string) $this->options->phpFCGIBacklog,
$config
);
$config = str_replace(
"__CHILDREN__",
$this->options->serverThreads,
(string) $this->options->phpFCGIChildren,
$config
);
$config = str_replace(
Expand Down Expand Up @@ -163,6 +168,7 @@ protected function getEnvironmentVariables(): Map<string, string> {
return Map {
'OSS_PERF_TARGET' => (string) $this->target,
'PHP_FCGI_CHILDREN' => (string) $this->options->phpFCGIChildren,
'PHP_FCGI_BACKLOG' => (string) $this->options->phpFCGIBacklog,
'PHP_FCGI_MAX_REQUESTS' => '0',
};
}
Expand Down
10 changes: 9 additions & 1 deletion base/PerfOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ final class PerfOptions {
public array $phpExtraArguments;

public int $phpFCGIChildren;
public int $phpFCGIBacklog;

public string $siege;
public string $nginx;
Expand Down Expand Up @@ -117,6 +118,7 @@ final class PerfOptions {
public ?string $scriptAfterWarmup;
public ?string $scriptAfterBenchmark;
public string $serverThreads = '100';
public string $serverBacklog = '256';
public string $clientThreads = '200';

public bool $notBenchmarking = false;
Expand Down Expand Up @@ -166,6 +168,7 @@ public function __construct(Vector<string> $argv) {
'hhvm-extra-arguments:',
'php-extra-arguments:',
'php-fcgi-children:',
'php-fcgi-backlog:',
'no-time-limit',
'fetch-resources',
'skip-sanity-check',
Expand Down Expand Up @@ -314,7 +317,12 @@ public function __construct(Vector<string> $argv) {
$this->hhvmExtraArguments = $this->getArray('hhvm-extra-arguments');
$this->phpExtraArguments = $this->getArray('php-extra-arguments');

$this->phpFCGIChildren = $this->getInt('php-fcgi-children', 100);
$output = [];
exec('nproc', $output);
$numProcessors = (int)($output[0]);

$this->phpFCGIChildren = $this->getInt('php-fcgi-children', $numProcessors * 2);
$this->phpFCGIBacklog = $this->getInt('php-fcgi-backlog', 256);
$this->delayNginxStartup = $this->getFloat('delay-nginx-startup', 0.1);
$this->delayPhpStartup = $this->getFloat('delay-php-startup', 1.0);
$this->delayProcessLaunch = $this->getFloat('delay-process-launch', 0.0);
Expand Down
2 changes: 2 additions & 0 deletions conf/php-fpm.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ listen = 127.0.0.1:__FASTCGI_PORT__
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
listen.allowed_clients = 127.0.0.1

listen.backlog = __BACKLOG__

; static - a fixed number (pm.max_children) of child processes;
pm = static

Expand Down
6 changes: 6 additions & 0 deletions conf/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ opcache.max_accelerated_files=100000
opcache.max_wasted_percentage=5
opcache.memory_consumption=1024
opcache.consistency_checks=0

zend.assertions=-1
zend.detect_unicode=0
mysqlnd.collect_statistics=0
opcache.huge_code_pages=1
opcache.optimization_level=-1