Implement room instancing in socketio-server.js#458
Conversation
|
I'd be curious about metrics here, i.e how many users (10, 100, 1000...) managed on which hardware (RPi Zero, RPi5, i9...) and what is the bottleneck. |
|
If you need perf, I'll probably rewriting server/socketio-server.js with |
|
test done on my machine, 32GB of memory, 8 cores socketio adaptera room of 50 users is about 30% cpu for networked-aframe-server, 0.3% memory, smooth movement, my 8 cores were at 78% for 50 chrome windows wseasyrtc adapterTested with a room of 50 users is about 80% cpu for networked-aframe-server, 1.7% memory, some choppy movements, I don't know if it's server side or client side, probably both, because I was testing both clients and server on the same machine, my 8 cores were at 95% easyrtc adapter (so WebRTC datachannel instead of WebSocket for data, no audio)a room of 50 users, very choppy movement janus adapter20 users in a room with audio, cpu 84%, memory 0.3%, some choppy movements 20 users in a room with audio, cpu 78%, memory 0.3%, some choppy movements, my 8 cores were at 98% for 20 chrome windows 20 users in a room with audio, cpu 63%, memory 0.3%, some choppy movements with networked-audio-source="positional: true", smooth movements without networked-audio-source or with networked-audio-source="positional: false", my 8 cores were at 68% for 20 chrome windows. With networked-audio-source="positional: true", my 8 cores were at 88% Chrome profiling gives sometimes linearRampToValueAtTime 4.26 ms with positional audio, so hearing the positional audio is really the bottleneck on the browser. |
|
@Utopiah for now maximum is 70 users in a room with socketio server with socketio 4.8.1 running with node or bun on a Raspberry Pi 400 (ARM Cortex-A72 Quad-core 1.8 GHz) |
Use case: experience with 3000 users, using room instancing by batch of 50 users, no audio, no video, only websocket. We are interested only in avatar movements.
For 50 in a room, you probably want to reduce the update rate to 1 per second instead of 15 by setting
NAF.options.updateRate = 1(doc)If you test it inside the networked-aframe repo, be sure to use
npm run dev-socketioand settingnetworked-scene="adapter:socketio"in the basic.html or basic-chat.html examples.Be aware there are pending issues with the socketio adapter:
That's a quick implementation I tested only with
maxOccupantsInRoom = 3instead of 50.I didn't test the load. Someone has to create a script to test 3000 connections, creating the websocket, sending avatar positions every second, do that for a random duration about 30 seconds to 3 min for each connection and close the websocket connection to see how the node process supports the load.
If someone wants to go further, some things to be tested for cpu/memory/latency: