Page MenuHomePhabricator

Add support for JIT in PHP 8.4 images
Open, LowPublic

Description

JIT is a notable feature introduced in PHP8. In this task, we are adding the relevant switches in our production images, having these features off by default.

It is important to note that JIT requires opcache to be enabled both in php-cli and php-fpm

NOTE: This work should wait until we have migrated to PHP 8.4 or later (the new IR-based JIT lands in 8.4; see T384294#10494399).

Event Timeline

Change #1113124 had a related patch set uploaded (by Effie Mouzeli; author: Effie Mouzeli):

[operations/docker-images/production-images@master] php8.1-cli: introduce opcache and JIT

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

Change #1113138 had a related patch set uploaded (by Effie Mouzeli; author: Effie Mouzeli):

[operations/docker-images/production-images@master] php8.1: introduce JIT

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

@jijiki I've looked into JIT in php 8.1 a bit, and it seems like it had several serious bugs (see for example this), to the point that it's been reimplemented from scratch for PHP 8.3.

For sure we shouldn't use it in production, but also, I'm not sure we even want the option to enable it at the moment, given the amount of issues that were found with it.

Ah, interesting! I was unaware of the changes in 8.3 mentioned in T384294#10480405. If that's the case, then I wonder whether it makes sense to defer until after we make the switch later this (calendar) year ... Basically, even setting aside potential reliability issues prior to 8.3, I'm wondering whether it makes sense to invest in JIT performance tuning on 8.1 if it's significantly reworked in 8.3.

Ah, interesting! I was unaware of the changes in 8.3 mentioned in T384294#10480405. If that's the case, then I wonder whether it makes sense to defer until after we make the switch later this (calendar) year ... Basically, even setting aside potential reliability issues prior to 8.3, I'm wondering whether it makes sense to invest in JIT performance tuning on 8.1 if it's significantly reworked in 8.3.

That was kind of my point, and to be clear JIT has been rewritten from scratch (by the same person who wrote it for 8.1...).

In addition JIT on 8.1 is notoriously a segfault factory. I'd wait at least until we install 8.3 or 8.4.

Ah, interesting! I was unaware of the changes in 8.3 mentioned in T384294#10480405. If that's the case, then I wonder whether it makes sense to defer until after we make the switch later this (calendar) year ... Basically, even setting aside potential reliability issues prior to 8.3, I'm wondering whether it makes sense to invest in JIT performance tuning on 8.1 if it's significantly reworked in 8.3.

That was kind of my point, and to be clear JIT has been rewritten from scratch (by the same person who wrote it for 8.1...).

In addition JIT on 8.1 is notoriously a segfault factory. I'd wait at least until we install 8.3 or 8.4.

It is def not ideal, however I reckon it will be useful to at least do some light testing and fiddle with it against different workloads, when we find it appropriate (SREs, devs, whoever would like to have a go). Given that it is disabled by default, I believe it is alright. We can postpone adding the relevant values to the mediawiki chart for a later time. How does that sound?

jijiki moved this task from Incoming 🐫 to Doing 😎 on the serviceops-deprecated board.
Krinkle added a subscriber: TK-999.

+1 for waiting until PHP 8.4. The new IR-based JIT landed in PHP 8.4. PHP 8.3 has the same old JIT as PHP 8.1.

I believe @TK-999 has tried this back at Fandom, and filed several issues upstream where it crashed with MediaWiki.

As much as Debian LTS covers us for security issues, it does not cover bug fixes, and PHP 8.1 is already out of active support since Nov 2023, so we'd not be in a good place to get things fixed with this in production.

Reedy renamed this task from Add support for JIT in PHP8.1 images to Add support for JIT in PHP 8.1 images.Mar 7 2025, 11:07 PM
Krinkle renamed this task from Add support for JIT in PHP 8.1 images to Add support for JIT in PHP 8.4 images.Jul 17 2025, 3:29 AM
MLechvien-WMF subscribed.

Hi Scott, do you know if this task still makes sense after the PHP Upgrade completed last quarter?

@MLechvien-WMF - Thanks for checking. Agreed with Timo in T384294#10494399 that this should wait until we're on PHP 8.4 or later, which is when the re-written JIT compiler lands. That means some time during / after Q1/Q2 FY26-27. I've updated the task description to highlight this and am moving it to backlog.

Change #1113124 abandoned by Effie Mouzeli:

[operations/docker-images/production-images@master] php8.1-cli: introduce opcache and JIT

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