🗃️Private Network Configuration
Private Network Scaling
The clustering method provides the alternative of running the communication between nodes without having to deal with a third-party channel like Redis Pub/Sub. The protocol is, in fact, decentralized.
No matter how many soketi processes you open with the Cluster driver, you will have built-in scalability without additional servers. It's highly recommended to use the cluster adapter when you deploy soketi behind the same private network with PM2 to acquire multithreading.
The only downside to the cluster adapter is that you can only scale processes or instances which are within the same network. The protocol used is tied to a hostname which should be the same for all instances. This can be highly effective when deploying to Kubernetes clusters or behind the firewall, in the same network. To deploy in multi-mesh architectures, consider using Redis Pub/Sub.
Keep in mind you should also set the Rate Limiting driver to cluster
to ensure the rate limiting is even across all your workers.
To deploy to Kubernetes, you should have a CNI that supports Multicast, Unicast or Broadcast, otherwise the Cluster adapter won't work. The best one would be Weave.
Environment Variables
These environment variables are working only when the ADAPTER_DRIVER
variable is set to cluster
.
Make sure to choose the same port and hostname if you want the nodes to communicate between each other properly. Deploying multi-tenant architectures should use different ports or hostnames.
Built-in IPC
IPC is enabled automatically for running servers, and this is used in various cases, like storing rate-limiting buckets or scaling horizontally in the same private network.
Beside scaling horizontally, that can be done by configuring the Redis adapter, each running instance of soketi is able to communicate with other nodes that run in the same private network via the IPC protocol in Node.js.
Last updated