📡
Soketi
0.x
0.x
  • 📡soketi
  • 🏆Benchmarks
  • 🎉Support
  • 🤝Contributing
  • 😢Known Limitations
  • Getting started
    • 🚀Installation
      • CLI Installation
      • Docker
      • Helm Charts
      • Laravel Sail (Docker)
    • 💿Configuring the server
    • 🔐SSL Configuration
    • 🎨Client Configuration
      • Pusher SDK
      • Laravel Echo
    • 💻Backend Configuration
      • Pusher SDK
      • Laravel Broadcasting
      • Nginx Configuration
    • 🧠Redis Configuration
  • App Management
    • 🎟️Introduction
    • 🧬Array Driver
    • 🛢️SQL Drivers
      • 🐬MySQL
      • 🐘PostgreSQL
      • ⛲Database Pooling
    • 👾DynamoDB
  • Rate Limiting & Limits
    • ⛔Broadcast Rate Limiting
    • 👥Events & Channels Limits
  • Advanced Usage
    • ↔️Horizontal Scaling
      • 🤖Running Modes
      • 🧠Redis Configuration
      • 🧙‍♂️🧙♂ 🧙♂ 🧙♂ NATS Configuration
      • 🗃️Private Network Configuration
      • 😑Ok, what to choose?
    • 🛑Graceful Shutdowns & Real-time monitoring
    • 📈Prometheus Metrics
    • 🔗HTTP Webhooks
      • 📐AWS Lambda trigger
    • 🕛Queues
      • ⛓️AWS SQS FIFO
      • 🧠Redis
  • Network Watcher
    • 🚀Installation
    • 💿Environment Variables
Powered by GitBook
On this page
  • Private Network Scaling
  • Environment Variables
  • Built-in IPC

Was this helpful?

Edit on GitHub
  1. Advanced Usage
  2. Horizontal Scaling

Private Network Configuration

Previous🧙♂ 🧙♂ 🧙♂ NATS ConfigurationNextOk, what to choose?

Last updated 3 years ago

Was this helpful?

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.

ADAPTER_DRIVER=cluster soketi start

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 .

Keep in mind you should also set the 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 .

Environment Variables

These environment variables are working only when the ADAPTER_DRIVER variable is set to cluster.

Name
Default
Possible values
Description

CLUSTER_CHECK_INTERVAL

500

Any number

The amount of time (in ms) between checks to see if new instances joined the network.

CLUSTER_HOST

0.0.0.0

Any string

The hostname to bind to the network.

CLUSTER_MASTER_TIMEOUT

2000

Any number

The amount of time (in ms) between checks to see if the master instance is alive.

CLUSTER_NODE_TIMEOUT

2000

Any number

The amount of time (in ms) between checks to see if the instances are alive.

CLUSTER_PORT

11002

Any number

The port to communicate with other instances.

CLUSTER_BROADCAST_ADDRESS

255.255.255.255

Any IP

The address in the private network for the broadcast protocol. Broadcast is enabled by default as the UDP protocol.

CLUSTER_MULTICAST_ADDRESS

null

Any IP

The address in the private network for multicasting. Setting this disables broadcasing.

CLUSTER_UNICAST_ADDRESSES

null

JSON-formatted array of IPs.

The list of addresses in the private network for unicasting. Setting this disables multicasting and broadcasting.

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 or .

Beside scaling horizontally, that can be done by configuring the , 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.

↔️
🗃️
Redis Pub/Sub
Rate Limiting driver
Weave
Redis adapter
rate-limiting buckets
scaling horizontally in the same private network