SocketCluster / SocketCluster/socketcluster-server

socketCluster-server with SCC | redis and streams | connections

Open
#36 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
109
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Hello,

I would like to implement what is describe in the SCC guide, from what I understand from the guide, if I use the socketcluster-server I should be able to scale automatically vertically and horizontally.

Could you please tell me what are the network requirement between the sc-state, sc-broker and the scc-server ? Does 80/443 is enough or the sc-state use additional ports ?

In my backend I use redis stream to pub/sub streams to specific channels/rooms using GROUP and XREADGROUP + rxJs, can I use the sc-redis as a base to create the necessary adapter ?

Last thing is more about the logic/management or how to deal with connections like RabbitMQ, ... As per the following doc of RabbitMq I'm not quite sure to understand how to apply what follow below with socketCluster...

As SCC will scale horizontally across the CPUs of my instance, should I create my connections on the master(server.js) and share it across all the brokers/workers and open channels from there ?

Don’t open and close connections or channels repeatedly
Have long lived connections if possible, and use channels for each task. The handshake process for an AMQP connection is quite complex and requires at least 7 TCP packets (more if TLS is used). Channels can be opened and closed more frequently if needed. Even channels should be long-lived if possible, e.g., reuse the same channel per thread for publishing. Don’t open a channel each time you are publishing. If you can't have long lived connections, then make sure to gracefully close the connection Best practice is to reuse connections and multiplex a connection between threads with channels.

AMQP connections: 7 TCP packages
AMQP channel: 2 TCP packages
AMQP publish: 1 TCP package (more for larger messages)
AMQP close channel: 2 TCP packages
AMQP close connection: 2 TCP packages
Total 14-19 packages (+ Acks)

and (most important)

Don’t share channels between threads
You should make sure that you don’t share channels between threads as most clients don’t make channels thread-safe (because it would have a serious negative impact on performance).

The concept of cluster using nodeJs is quite new for me and due to some restriction we can not use the framework version of socketCluster. Looking forward to read to answers.

Thanks by advance.
fas3r

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scc-guide.md and the socketcluster-server entry point, then trace how sc-state, sc-broker, scc-server, and sc-redis are connected. The issue provides no named tests or concrete acceptance criteria; done would require resolving the network, Redis Streams adapter, and connection-management design questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, redis
Domain
backend, distributed-systems, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.