Page MenuHomePhabricator

Clean up and abstract PHP_ENGINE 8.1 routing
Closed, ResolvedPublic

Description

In T377042: Support cookie-driven fractional migration to PHP 8.1 deployments of mw-web and mw-api-ext, we configured the WikimediaEvents extension [0] for incremental enrollment of client session in PHP 8.1 via the PHP_ENGINE cookie and added an ATS Lua script to support selection of the -next services when PHP_ENGINE=8.1.

The purpose of this task is to:

  • Clean up the 8.1-migration-specific configuration in InitialiseSettings.php (i.e., WikimediaEvents stops actively managing the cookie).
  • Remove the now-latent Lua script [1] from the relevant plugin chains in [2].
  • Figure out how we want to abstract the Lua script to more generically support -next routing, either for future PHP migrations or other use cases.

The solution we've gone with initially has the following properties:

  • Routing remains cookie-based, but supports an arbitrary cookie pattern for identification of eligible requests. The pattern is defined in the config table file (cookie_pattern), rather than in the script.
  • The config table now supports an enabled entry which, if false, causes the script to immediately return TS_LUA_REMAP_NO_REMAP on entry, without inspecting the request further. This makes it far cheaper to leave the script in the relevant plugin chains.
  • There are no changes to the load_fraction config table entry (i.e., as before, it is a random selection probability applied to eligible requests).

[0] https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikimediaEvents/+/refs/heads/master/modules/ext.wikimediaEvents/phpEngine.js
[1] https://gerrit.wikimedia.org/r/plugins/gitiles/operations/puppet/+/refs/heads/production/modules/profile/files/trafficserver/mw-php-migration.lua
[2] https://gerrit.wikimedia.org/g/operations/puppet/+/refs/heads/production/hieradata/common/profile/trafficserver/backend.yaml

Event Timeline

I would suggest we make this "permanent" in lua, with some configured escape so we don't actually execute the whole lua for every request when we have no experiment running.

I would suggest we make this "permanent" in lua, with some configured escape so we don't actually execute the whole lua for every request when we have no experiment running.

If it's not a performance to concern to keep the script in the relevant plugin chains as long as we add a (very) early return, then that would definitely simplify future reuse.

I will have to remove it as part of the initial cleanup here, primarily so that I can rename it - e.g., from mw-php-migration.lua to mw-next-routing.lua (or similar) - but will plan to wire it back in as part of end-state of this task.

Change #1135504 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] hieradata: remove mw-php-migration.lua from plugin chains

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

Change #1135505 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] P:trafficserver::backend: absent mw-php-migration

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

Change #1135506 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] P:trafficserver::backend: remove mw-php-migration

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

Change #1135507 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/mediawiki-config@master] Remove PHP 8.1 migration WikimediaEvents settings

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

Change #1135507 merged by jenkins-bot:

[operations/mediawiki-config@master] Remove PHP 8.1 migration WikimediaEvents settings

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

Mentioned in SAL (#wikimedia-operations) [2025-04-14T17:04:13Z] <swfrench@deploy1003> Started scap sync-world: Backport for [[gerrit:1135507|Remove PHP 8.1 migration WikimediaEvents settings (T391421)]]

Mentioned in SAL (#wikimedia-operations) [2025-04-14T17:08:53Z] <swfrench@deploy1003> swfrench: Backport for [[gerrit:1135507|Remove PHP 8.1 migration WikimediaEvents settings (T391421)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-04-14T17:17:23Z] <swfrench@deploy1003> Finished scap sync-world: Backport for [[gerrit:1135507|Remove PHP 8.1 migration WikimediaEvents settings (T391421)]] (duration: 13m 10s)

Mentioned in SAL (#wikimedia-operations) [2025-04-14T17:20:53Z] <swfrench-wmf> running: cumin 'A:cp-text' 'disable-puppet "merging ATS config change - T391421"'

Change #1135504 merged by Scott French:

[operations/puppet@production] hieradata: remove mw-php-migration.lua from plugin chains

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

Mentioned in SAL (#wikimedia-operations) [2025-04-14T17:25:36Z] <swfrench-wmf> running: run-puppet-agent -e "merging ATS config change - T391421" on cp4040

Mentioned in SAL (#wikimedia-operations) [2025-04-14T17:30:47Z] <swfrench-wmf> running: cumin -b8 -s60 'A:cp-text' 'run-puppet-agent -e "merging ATS config change - T391421"'

Change #1135505 merged by Scott French:

[operations/puppet@production] P:trafficserver::backend: absent mw-php-migration

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

Change #1135506 merged by Scott French:

[operations/puppet@production] P:trafficserver::backend: remove mw-php-migration

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

Scott_French changed the task status from Open to In Progress.Apr 14 2025, 7:00 PM

Alright, we're now free to rename and refactor mw-php-migration.lua et al.

Change #1154900 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] trafficserver: rename mw-php-migration to mw-next-routing

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

Change #1154901 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] trafficserver: generalize mw-next-routing.lua

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

Change #1154900 merged by Scott French:

[operations/puppet@production] trafficserver: rename mw-php-migration to mw-next-routing

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

Change #1154901 merged by Scott French:

[operations/puppet@production] trafficserver: generalize mw-next-routing.lua and prep for PHP 8.3

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

Scott_French updated the task description. (Show Details)