Page MenuHomePhabricator

Install php 7.4 in production
Closed, ResolvedPublic

Description

Install php 7.4 on

  • mwdebug servers
  • maintenance servers
  • canaries
  • parsoid
  • jobrunner
  • appserver
  • api

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
ResolvedJdforrester-WMF
ResolvedJdforrester-WMF
ResolvedJdforrester-WMF
ResolvedJdforrester-WMF
Resolved toan
ResolvedLucas_Werkmeister_WMDE
ResolvedJoe
ResolvedJdforrester-WMF
ResolvedLadsgroup
InvalidNone
ResolvedReedy
OpenNone
Resolved tstarling
ResolvedJdforrester-WMF
ResolvedPRODUCTION ERRORLegoktm
Resolved tstarling
ResolvedJoe
ResolvedJoe
ResolvedJoe
ResolvedJoe

Event Timeline

Change 808908 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] mediawiki: install php7.4 on the mwdebug servers

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

Change 808909 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] mediawiki: install php7.4 on the canaries

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

Change 808910 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] mediawiki: install php7.4 on jobrunners

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

Change 808911 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] mediawiki: install php7.4 on the maintenance server

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

Change 808912 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] mediawiki: install php7.4 on all appservers

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

I have updated our PHP build in component/php74 to the latest 7.4.x release; 7.4.30. Uploaded as 7.4.30-3+0~20220627.69+debian10~1.gbpf2b381+wmf1+buster1

Change 808908 merged by Giuseppe Lavagetto:

[operations/puppet@production] mediawiki: install php7.4 on the mwdebug servers

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

I've installed php 7.4 on the mwdebug servers. Modulo a series of small issues with resource ordering, and the package referencing a bullseye+ only script, the process went well.

I'll run some tests next, and also probably modify X-Wikimedia-Debug to be able to reach php 7.4 too.

@Krinkle noticed that mwdebug1001 was not actually serving pages with PHP 7.4 when requested via a cookie. I isolated the issue, reproduced it locally, and tested a fix.

/etc/apache2/conf-available/50-fcgi-proxies.conf has

# Configure the proxies

# Proxy for php version 7.2
<Proxy "unix:/run/php/fpm-www.sock|fcgi://localhost">
       ProxySet retry=0
</Proxy>
# Proxy for php version 7.4
<Proxy "unix:/run/php/fpm-www-7.4.sock|fcgi://localhost">
       ProxySet retry=0
</Proxy>

Only the part of the URL after the pipe is used for matching, so both of these Proxy workers match every PHP request. The first one is used. Then when the request is dispatched, it uses the UNIX path defined by the worker, not the one from the request.

My proposed solution is to use a single worker, configured similarly to the default worker. Omit the UNIX socket path, to ensure that worker->s->uds_path is null, since this triggers detection of the UNIX socket path from the request information. It's also necessary to disable connection reuse, otherwise the second request that comes in will use the same connection as the first, regardless of the desired UNIX socket path.

<Proxy "fcgi://localhost">
       ProxySet retry=0 disablereuse=on
</Proxy>

Also I noticed that the socket path is incorrect. In Apache it is /run/php/fpm-www-7.4.sock, but the actual socket defined by the PHP configuration is /run/php/fpm-www-7-4.sock, with a hyphen between 7 and 4. I prefer the one with the dot because that's how you spell version numbers. The issue with Proxy directives hid this issue.

Joe triaged this task as High priority.

Thanks @tstarling in fact we only tested tcp proxying in beta. I've gone a slightly different way than you suggested, adding an additional worker with a different name instead than just disabling reuse of it, which would be a performance penalty.

So now our proxies section looks like:

# Configure the proxies

# Proxy for php version 7.2
<Proxy "unix:/run/php/fpm-www.sock|fcgi://localhost">
       ProxySet retry=0
</Proxy>
# Proxy for php version 7.4
<Proxy "unix:/run/php/fpm-www-7.4.sock|fcgi://www-7.4">
       ProxySet retry=0
</Proxy>

and the corresponding routing in the vhosts is:

# Default: no/invalid cookie or default version
<If "reqenv('backend') in  {'', '7.2'}">
    SetHandler "proxy:unix:/run/php/fpm-www.sock|fcgi://localhost"
</If>
# Version 7.4
<ElseIf "reqenv('backend') == '7.4'">
    SetHandler "proxy:unix:/run/php/fpm-www-7.4.sock|fcgi://www-7.4"
</ElseIf>

Mentioned in SAL (#wikimedia-operations) [2022-06-30T13:00:33Z] <moritzm> uploaded php-defaults 76+wmf1+buster2 for component/php74 (drops a Breaks: on php72-common) T311386

Mentioned in SAL (#wikimedia-operations) [2022-06-30T13:05:48Z] <moritzm> upgrade mwdebug* servers to 2:76+wmf1~buster2 T311386

Change 810312 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] mediawiki: allow forcing the backend for blank page on wikipedia

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

Change 810313 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] lvs: check php 7.4 too on all appservers

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

Change 810348 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] jobrunner: allow selecting explicitly the backend when performing health checks.

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

Change 808909 merged by Giuseppe Lavagetto:

[operations/puppet@production] mediawiki: install php7.4 on the canaries

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

Mentioned in SAL (#wikimedia-operations) [2022-07-05T08:30:41Z] <moritzm> uploaded 7.4.30-3+0~20220627.69+debian10~1.gbpf2b381+wmf1+buster3 to component/php74 (pulling php-common with the socket helper) T311386

After the installation on the mediawiki canaries, I ran our standard "benchmw" set of benchmarks on both php 7.2 and 7.4 in codfw. In general we see better performance from php 7.4 especially when we do things that require a lot of php computations, like re-parsing.

Specifically, see

percentiles_a_reparse_heavy_c20.png (1×1 px, 26 KB)
for re-parsing of a heavy page. In this case, php 7.4 performs 25% better actoss pretty much all percentiles.

For stuff that requires a less heavy work, like a page view of english wikipedia, the difference is more like 10% in favour of php 7.4

percentiles_a_view_mainpage_c20.png (1×1 px, 22 KB)

A similar gain holds for all pageviews, see also a lighter wiki page view

percentiles_a_view_short_c20.png (1×1 px, 22 KB)

and a startup JS bundle produced by load.php still shows a significant gain

percentiles_a_rl_startup_c20.png (1×1 px, 23 KB)

while as one would expect the gain for loading a plain css file via load.php is smaller and mostly negligible

percentiles_a_rl_css_c20.png (1×1 px, 23 KB)

Change 808910 merged by Giuseppe Lavagetto:

[operations/puppet@production] mediawiki: install php7.4 on jobrunners

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

Change 808911 merged by Giuseppe Lavagetto:

[operations/puppet@production] mediawiki: install php7.4 on the maintenance server

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

Change 811585 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] mediawiki: install php 7.4 on all maintenance servers

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

Change 811585 merged by Giuseppe Lavagetto:

[operations/puppet@production] mediawiki: install php 7.4 on all maintenance servers

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

Change 808912 merged by Giuseppe Lavagetto:

[operations/puppet@production] mediawiki: install php7.4 on all appservers

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

Change 810348 merged by Giuseppe Lavagetto:

[operations/puppet@production] jobrunner: allow selecting explicitly the backend when performing health checks.

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

Change 810312 merged by Giuseppe Lavagetto:

[operations/puppet@production] mediawiki: allow forcing the backend for blank page on wikipedia

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

Change 810313 merged by Giuseppe Lavagetto:

[operations/puppet@production] lvs: check php 7.4 too on all appservers

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