Open devashish-gopalani-cognoai opened 1 year ago
@devashish-gopalani-cognoai could you try without DEBUG=*
? Without the admin UI instrumentation?
@darrachequesne so I did remove the admin UI tool but the issue still persisted. Later on I found out that my artillery script was the issue. All socket connections which were getting created were joining the same room ("abcd"). I could not find a way to dynamically generate rooms in the artillery script but I applied some logic on the Socket.IO servers side and voila, the issue got resolved!
As of now, when the emit rate reaches around 4500 then I start getting a count for failed vusers. I have noticed that the CPU usage spikes up-to 60-70% at that time. I still had a few questions though:
@devashish-gopalani-cognoai make sure to add cleanupEmptyChildNamespaces
flag if you ever start using dynamic namespaces/rooms, otherwise your adapter will leak.
See https://github.com/socketio/socket.io/pull/4602
also, i see your script is using socket.io admin-ui which uses middlewares to reject socket connections. I just found another leak that you might eventually suffer from as well: https://github.com/socketio/socket.io/issues/4772
@carera I have commented the admin-ui part so memory leak because of that shouldn't happen now because of that. Coming to dynamic namespaces, I saw the issue which you shared. It seems to be only for dynamic namespaces and I am not creating namespaces dynamically. They are predefined. However I am creating rooms dynamically. Would this flag help over there too?
I am not sure how rooms work in context of the redis adapter. One way to find out, i guess?
Describe the bug I have been trying to load test my Socket.IO service using artillery (attached the script by the name of load-test.yml). Unfortunately, when I do so, I end up getting the below results:
Now the vusers.failed count has also gone upto 1500 (in other tests that I have ran). To debug further, I enabled logs of my server and figured out that there seems to be a memory leak and hence the service was stopping and restarting again. The log which I found on the server was:
I have also taken heap snapshots and unfortunately, I don't find any of them leading to the code which I have written. Would this indicate that there is something wrong with the library? Please correct me if I am wrong. I am attaching the screenshots of the comparison done between heap snapshots:
To Reproduce
Socket.IO server version:
4.6.0
Server
index.js
cobrowse.js
Socket.IO client version:
artillery-engine-socketio-v3 - v1.1.3
Client
Artillery .yaml script
Infrastructure Specifications: There are 2 servers each with 4 cores and 8GB ram. Both of them are running the Socket.IO instance and one of them is running redis. There is an AWS ALB present in front of the two websocket servers, I am using only websockets and not HTTP polling.
Additional context I also minify my code using webpack. The remaining package version details can be found in the package.json file. You can find my code over here WebSocketServiceExport.zip.