GithubHelp home page GithubHelp logo

Comments (2)

Mukund2900 avatar Mukund2900 commented on June 4, 2024

Async await works very well when we work on a dev environment, due to ease of use and understanding. Even when load is not much it looks very promising, until there is an actual load.
Obviously if we increase the number of machine it will work fine. But when benchmarking with same setup callbacks scale much better.

from socketcluster.

jondubois avatar jondubois commented on June 4, 2024

When running in v14, do you run as multiple worker processes? In v14, it would scale across multiple processes on the same host so it can be a factor which could make it look like it performs better (though in reality it just has more capacity). This approach was abandoned as it has some disadvantages when used with tools like Docker and Kubernetes which tend to encourage single-process instances on the back end (it simplifies monitoring). It's possible that async/await can use more CPU though it should be possible to minimize the impact by optimizing how it's used in your application logic (e.g. avoid making too many expensive I/O calls like database lookups during connection handshake).

Note that you can run multiple scc-worker instances on a single host on different ports; if the host has enough CPU cores, they won't slow each other down. You can also launch multiple scc-broker instances as required and you also need an scc-state instance to coordinate. So it would act like a cluster but on a single host. You can also use an additional load balancer like nginx, apache or haproxy listening on port 443 (or 80) to forward WebSocket connections to your SC instances which are running on other ports on the same host. A good approach is to make the load balancer act as a terminating proxy for SSL/TLS so that it handles encryption and forwards plain traffic to the SC worker instances (that way you don't need the SC instances to be configured for HTTPS/WSS).

You can read the SCC guide here: https://github.com/SocketCluster/socketcluster/blob/master/scc-guide.md - but instead of setting up your cluster on multiple hosts as described, you can set it up on a single host; it works essentially the same way. It scales well (linearly) on a single large machine if you have no more than 1 process per CPU core.

from socketcluster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.