magento-hackathon / developer-paradise-2016

2 stars 3 forks source link

Make Magento work with ReactPHP #3

Open schmengler opened 8 years ago

schmengler commented 8 years ago

ReactPHP (http://reactphp.org/) is an event based PHP server, working similar to node.js. It's not starting a new process for every request so there could be a huge performance boost because the expensive bootstrapping of Magento is not necessary all the time.

However, one has to differentiate between application wide global state and request specific global state, so I expect that we need to do make quite some changes in the object manager.

sdesmet commented 7 years ago

While ago, but @schmengler how far did you get with this? This really seems where we are/should be going in PHP now that we can write decent HTTP servers directly in PHP given the important changes introduced in version 7.0 & 7.1 and have concurrency frameworks like ReactPHP. No reason why not to apply this model to Magento so your proposal makes perfect sense.

schmengler commented 7 years ago

Not very far. We were able to make a demo but very limited functionality. Unfortunately swapping out the Request and Response interfaces is currently not possible because Magento relies on the actual implementation at too many places. I talked to @antonkril about it and they are aware of it, but it doesn't have the highest priority in the backlog. Might take another few years, if there is no big community driven initiative.

antonkril commented 7 years ago

@schmengler the headless initiative will get us much closer to the desired state.

Also, have you tried replacing Request with inherited mutable implementation?

schmengler commented 7 years ago

I tried to create a PSR-7 compatible implementation and could not see how this would be possible by inheriting from the core implementation. I don't remember which methods exactly were problematic though