-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[Question] Server Multi Threading #5664
Comments
Swoole was not compiled with the |
Due to the inability of ZendVM to support a multi-threaded environment, even if multiple Reactor threads are set in SWOOLE_PROCESS mode, only one dispatch_func can be executed at a time. Therefore, the underlying execution of this PHP function will involve locking operations, which may lead to lock contention issues |
In Swoole 6.0, when you set the dispatch_func, single_thread is automatically set to true. |
Hey, so this is how i compiled it:
I removed the dispatch_func:
Restarted service (this is a 2 cpu machine):
Thanks! |
change SWOOLE_BASE to SWOOLE_THREAD, |
Thanks for reply, unfortunately its not working very well. I tired 3 server implementation, all didn't seem to run properly, although they did only spawn 1 php process. It's just that the implementations would not process any api requests, TCP packets, or Websocket messages.
In addition to that during restarts of the processes i saw several errors:
Perhaps later tonight Ill convert my other process that is using: Thanks! |
Just to update, I've given up on this, i will still update to use v6 Thanks anyways! |
Hi, Thank you for the v6 release, I've started testing it. One thing I'm unclear on is how Multi Threading works with Server implementations. I've tried it with my existing implementation (But changed to use SWOOLE_BASE). I guess I'm unclear if its working, in the process list i still see a bunch of processes. With a server config like below, is it using threads in the workers automatically? if so how many threads? Or maybe i mis understood and threads are only present if created manually using,
Thread::exec(string $script_file, array ...$argv);
. Another thing i tested is'single_thread' => false
andSWOOLE_PROCESS
, which the documentation says NOT to do and no errors occurred.PHP Version:
Swoole Info:
Thanks!
The text was updated successfully, but these errors were encountered: