Skip to content

Instantly share code, notes, and snippets.

View acasademont's full-sized avatar

Albert Casademont acasademont

View GitHub Profile
@acasademont
acasademont / answers.md
Last active October 30, 2020 13:43
Answers to my "Supercharge your apps with ReactPHP & PHP-PM" PHP Barcelona 2019 talk

Question 182: Rasmus didn’t like async idea and he suggested to use queues and put hard works in other workers. What do you think about it?

We're talking about 2 separate things here, the ReactPHP way is not meant to be a replacement for workers to execute long-running tasks. It's meant to be a more efficient way to use your CPU and RAM resources even for very small requests by not blocking the process when doing I/O. Using a workers and queues for long-running tasks in the context of a ReactPHP app is also the recommended approach, do what Rasmus said!!

Question 179 If you want async, why not just use node? ReactPHP seems a very complicated way to achieve the same that node does

The question is, why not? IMHO it's fun and exciting to push the limits of a language. The fact that this hasn't been traditionally done by PHP doesn't mean it can't or shouldn't be tried or done. By thinking this way, Javascript would have never made it to the backends and become Node, because Javascript was never meant t