Comments (2)
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.
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)
- Worker is leaving instance repeatedly and reconnects after a while HOT 1
- Is it possible to merge publish messages? HOT 1
- SocketCluster version 16.0.1 SCC problem in minikube k8
- JWT token : invalid signature HOT 1
- `socketcluster create` screws up app name HOT 2
- badSocketAuthToken event not triggering HOT 2
- Unused dependencies HOT 1
- Bump Docker image HOT 1
- Socket connection gets timed out unexpectedly HOT 3
- Potential security issue HOT 5
- any way to send the missing socket update to client after network restore HOT 3
- We unable received the middleware sending error message from socket client HOT 2
- Has anyone tried to deploy socket cluster on Azure Container apps? HOT 1
- socket.on is not a function HOT 3
- BadConnectionError - socketcluster-client when requesting from server side. It works fine if the request is issued from the browser. HOT 3
- Namespace in channels HOT 3
- Is there any CPU/Memory Resources requests / limits recommendation?
- Socketcluster 16.x stopped working due to underlying library update HOT 1
- socketcluster compliance HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socketcluster.