Page MenuHomePhabricator

Quibble should configure php 7.4+ built in web server to use multiple workers
Closed, ResolvedPublic

Description

I have just found out that in PHP 7.4, the builtin webserver (php -S) supports multiple workers! From https://www.php.net/manual/en/features.commandline.webserver.php

Changelog

VersionDescription
7.4.0You can configure the built-in webserver to fork multiple workers in order to test code that requires multiple concurrent requests to the built-in webserver. Set the PHP_CLI_SERVER_WORKERS environment variable to the number of desired workers before starting the server. This is not supported on Windows.

It defaults to 1.

See also T225218: Consider httpd for quibble instead of php built-in server

Event Timeline

Change 730547 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/quibble@master] Support multiple workers in PHP 7.4+ web server

https://gerrit.wikimedia.org/r/730547

Change 730547 merged by jenkins-bot:

[integration/quibble@master] Support multiple workers in PHP 7.4+ web server

https://gerrit.wikimedia.org/r/730547

It could already be achieved by setting the PHP_CLI_SERVER_WORKERS environment variable and I went to add an option to Quibble: --web-php-workers WEB_PHP_WORKERS.

Change 734211 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/quibble@master] Release Quibble 1.2.0

https://gerrit.wikimedia.org/r/734211

Change 734211 merged by jenkins-bot:

[integration/quibble@master] Release Quibble 1.2.0

https://gerrit.wikimedia.org/r/734211

Released in Quibble 1.2.0

I would expect this to trigger most of the same race conditions as the Apache+quibble configuration. But this was deployed successfully?

I would expect this to trigger most of the same race conditions as the Apache+quibble configuration. But this was deployed successfully?

I don't see anything in integration/config using --web-php-workers so I think it is there, but not used. I'm also not sure this will trigger the same race conditions as Apache/PHP-FPM. I noted this somewhere (sorry, can't find it now) but it looks like when MediaWiki makes API requests to itself (done for Parsoid PHP), the same PHP thread that makes the request is also used to handle the request (so the multiple workers setup won't work for Parsoid integration), even when multiple workers are specified.

1.2.0 would still serve pages serially with the PHP builtin web server since --web-php-workers defaults to 1 and we do not set PHP_CLI_SERVER_WORKERS anyway.

Change 736240 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] jjb: switch jobs to Quibble 1.2.0

https://gerrit.wikimedia.org/r/736240

Change 736240 merged by jenkins-bot:

[integration/config@master] jjb: switch jobs to Quibble 1.2.0

https://gerrit.wikimedia.org/r/736240