Replies: 4 comments 1 reply
-
This is very specific to what an individual may be doing. A very simple solution is to not use defer on the main loop if it can be prevented, which is better design anyways. If it's possible to pass something into a msg queue it likely doesn't require resources specific to the server/main loop. |
Beta Was this translation helpful? Give feedback.
-
https://docs.mezzio.dev/mezzio-swoole/v4/considerations/ is blurring the lines with "defer", "event-loop", and "workers". Workers have pipes attached to the servers reactor but other than that the workers are decoupled from the server and it's resources, as well as it's event loop. If you use defer on the server it isn't deferred onto workers as it states but onto the servers eventloop. And it's not beneficial to use defer on the server unless you absolutely have to. If something able to be done away from the server process you have better options than a message queue or defer. The most confusing part is this statement:
This is not true. Swoole server basically creates two types of workers, request handlers and task handlers. If an incoming request must invoke a long running procedure the request handling worker can send the request into the task handlers for it to be processed there where it won't block any request handling workers. |
Beta Was this translation helpful? Give feedback.
-
And as far as being out dated the page doesn't have a date to know when it was created, but it references Swoole 4.1.2. |
Beta Was this translation helpful? Give feedback.
-
You have added very useful information which must be documented also on Swoole's Official Documentation. I am using Swoole for couple of years but it is first time i am coming to know that a Reactor's Event Loop is separate from the Event Loop for the Workers. Also, i think someone from Swoole MUST connect to the Mezzio community to inform them of what wrong they are spreading through their public documentation. Such wrong information causes many Architects to decide not to use Swoole, and choose other solutions. |
Beta Was this translation helpful? Give feedback.
-
Ref:-
https://docs.mezzio.dev/mezzio-swoole/v4/considerations/
Please, read the first three paragraphs on that page of Mezzio where they mention a problem (identified mainly in second paragraph), after which they recommend use of message queue as an alternate tool.
Is that correct ? that Event Loop's Defer blocks the WorkerProcess ? ( I feel that the information on that page may be out-dated)
I prefer not ot use Message Queues when using Swoole and / or Swoole Server.
Beta Was this translation helpful? Give feedback.
All reactions