On 10/09/2025 20:57, Gregory Magarshak wrote:
Hi everyone. Just wanted to follow up on this. Is there any chance of switch_global_context making it into PHP 9? This would be a huge game-changer as e.g. FrankenPHP in worker mode could literally be up to 100x faster than PHP-FPM! But right now, most frameworks which benefit from the awesome shared-nothing architecture (using static Foo::$bar, superglobals, PDO, etc.) are stuck, and need a complete rewrite. With this, they wouldn't.


Hi Gregory,

Something that's not necessarily obvious to new contributors is that the PHP project has no central organising committee, and no permanent core team. We now have the PHP Foundation to provide some stable funding (persuading companies to sponsor that is a great way to help the project!), but there's no official roadmap or backlog we can add ideas to.

What that means is that while new ideas are welcome, they're not necessarily going to get an immediate "yes" or "no". (It also means that everything in this e-mail is just the personal view of a long-term but minor contributor, and not any kind of official policy.)

Broadly, you need to start from one of these two points:

a) I've got an idea, and the necessary skills to implement it, but before I spend any more time on it I want to know if it's likely to be accepted by the Internals community b) I've got an idea, but don't have the necessary skills to implement it, would anyone be interested in working on it with me?

If nobody responds at all to an idea, it probably means that nobody really hates the idea, or can see a reason why it's impossible; but nobody is that excited by it either. If you're interested, you need to develop the idea further, and make clear if you're volunteering to implement it, or looking for a partner to implement it with you.


In this case, I'm not really clear what the proposal is, or how it would work. When exactly would the switch_global_context() function be called, and who would choose a value for $name? What kinds of state would it "switch", and how would that be different from switching between separate shared-nothing threads or child processes? Surely some (all?) of the speed-up of an event-based run-time is carrying state from one request to another.

I am definitely *not* an expert, but I also suspect it would be a lot more complex than you imply - there's a lot of different memory allocations and pointers involved in the PHP runtime, and even making them thread-safe involves a lot of complexity in the current implementation.


P.S. The rule here is to type your reply *below* the quoted text it's referring to, trimming as appropriate, as I've done here.

--
Rowan Tommins
[IMSoP]

Reply via email to