Skip to content
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

Why not use Coroutine in Worker Processes ? since Swoole version 4.7.1 introduces new concurrency mode. #418

Open
fakharak opened this issue Sep 26, 2022 · 1 comment
Assignees
Labels
analyzing Analyzing this issue

Comments

@fakharak
Copy link

fakharak commented Sep 26, 2022

  1. Your software version (Screenshot of your startup)

    Software Version
    PHP TODO
    Swoole TODO
    Laravel/Lumen TODO

    PHP 8.1
    OpenSwoole 4.11.1
    Laravel 9.0 but any version

  2. Detail description about this issue(error/log)

Since OpenSwoole version 4.7.1 a new concurrency mode has been introduced which makes worker process reload after completing each request just like PHP-FPM, and it still allows to use coroutines (concurrency) within request. So the requests are served by the Worker Process in Synchronous way but within each request we can use co:create, or go().

That enables traditional PHP-FPM based PHP-Frameworks to make smooth transition to OpenSwoole without change.

To enable that mode, we just need to make coroutine setting as below:
co::set([max_concurrency => 1]);

Question-1: Given the fact above, why not use coroutines in Swoole\Http\Server->on("request", callback() { }); in Larave-S ?
Question-2: Where to put configuration for co::set() in Laravel-S ?

@fakharak fakharak added the analyzing Analyzing this issue label Sep 26, 2022
@hhxsv5
Copy link
Owner

hhxsv5 commented Sep 26, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzing Analyzing this issue
Projects
None yet
Development

No branches or pull requests

2 participants