Replies: 3 comments 5 replies
-
BASE is not the same as BASIC At BASE mode, Swoole will skip a lot of overhead done at PROCESS mode so you can have a more reliable and faster system. Use PROCESS mode only if you need your Workers to communicate between each other. If you are in a cloud-native + k8s/container-orchestrated environment, you should be favoring BASE instead of PROCESS even more because your scale is based on new Pods, not on Swoole Workers inside the same machine. |
Beta Was this translation helpful? Give feedback.
-
Things like
Yeap, It is a cloud philosophy to have just a single process per container, so there is only a single Worker receiving requests and processing I/O Loop ( My personal recommendations:
Here you can have more info: https://wiki.swoole.com/#/learn?id=server%e7%9a%84%e4%b8%a4%e7%a7%8d%e8%bf%90%e8%a1%8c%e6%a8%a1%e5%bc%8f%e4%bb%8b%e7%bb%8d (right click and translate to english) |
Beta Was this translation helpful? Give feedback.
-
Many people do not have idea of the overheads of single-process containerized applications. In front of those overheads (in context of those overheads), the Inter-process Communication (IPC) is not a overhead, how ? Containers are single-process and to mimic an application spanning over multiple-processes (parallel processing), you throw multiple single-process Containers (using Kubernetes). Now, in order to communicate between those single-Process containers, you ideally use gRPC oevr Network which in turn uses HTTP-2. Container itself is a "image-copying" technique which is too slow at scale if compared to "Process Pool' in multi-process environment. Some also use Docker-engine (consider that a layer over Linux Containers) to run Docker-containers which internally use Linux containers, in turn. Ability to communicate between workers (which is an example of Broadcasting / publishing) on SWOOLE_PROCESS mode makes broadcasting lighting fast because through this technique data can be broadcast / published to different WebSocket Connections without making round-trips to Data Store), so it is faster, more reliable at scale. SWOOLE_BASE mode is same mode on which NodeJS works; all connections and event loops are created in Worker Process so if a Worker Process fails / stops all connections of the clients will break too. IN SWOOLE_PROCESS, if the worker process goes down then the "Manager Process" tries to pull in a new Worker Process from the pool of worker Process. there are some good reasons why many distributed applications like Multi-player Games, Databases, Block-chain and many Scalable Business Applications do not make use of Containerization. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The differences between these 2 modes (SWOOLE_BASE vs SWOOLE_PROCESS) are not very clear (at least to me).
When I look at the documentation - I was assuming (perhaps incorrectly) BASE = basic, so I would automatically configure SWOOLE_PROCESS mode thinking that is better and preferred.
But now - I see that swoole version 5 has made SWOOLE_BASE as default, and I also see some indications that SWOOLE_BASE should be preferred mode:
Is there some documentation on why SWOOLE_BASE should be preferred and how is it better than SWOOLE_PROCESS?
Beta Was this translation helpful? Give feedback.
All reactions