-
-
Notifications
You must be signed in to change notification settings - Fork 1
allow fork server in threads #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
{ | ||
public static function fork(int $numberOfWorkers, callable $asyncServer, int $numberOfFork = 0): void | ||
{ | ||
$pid = pcntl_fork(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just notice that the pcntl_fork
function is only available on Unix-based system.
The reference is available here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am searching for an alternative for windows without luck, this feature will only be available on nix systems I think. We can protect it from usage in Windows systems;-S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working o mutation tests now;- D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, do you consider using the pthread
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peter279k @mmoreram I've tried parallel extension with @xserrat a time ago, and we discard it for complexity issues(we make it run with a docker image created by @WyriHaximus) antidot-framework/antidot-react-psr15#1, both pthreads and parallel requires PHP compiled with ZTS and extra configuration(enable extension).
I propose to maintain this feature without the windows multi-thread support and opening a new issue to research and then add multi-thread support in windows systems.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this. The Parallel
extension looks good :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpicaza In the short term that's the easiest way to make this happen. Really interested to see how well this works with different event loops as this isn't something we've tried in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peter279k Yeah, I've build https://github.com/reactphp-parallel around it for a reason 😉 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @WyriHaximus, @mmoreram, and @peter279k for guidance;- D. I've just opened a new issue #14 to add support and document the usage by parallel ext.
c0039de
to
3331482
Compare
Description
Seeing the benchmark in https://github.com/the-benchmarker/web-frameworks we need to allow the option to fork the react-php server in the different threads available in the host machine.
Thanks to @mmoreram for helping me with this issue, and for your great work for the PHP community;- D