socketio / socket.io-admin-ui

Admin UI for Socket.IO
https://admin.socket.io
MIT License
358 stars 95 forks source link

Page unresponsive on 10K Socket Connections #22

Closed vishwassingh47 closed 2 years ago

vishwassingh47 commented 3 years ago

Page is not responsive when when large number of sockets are connected (~10K).

Have tested in 2 scenarios:

  1. Start SocketIO server,Open Admin UI Page, now add load 10K socket connections in realtime, 10K connections are instantly connected on the server but Admin UI Page couldn't keep up with the real count.It then became unresponsive as it is with flooded with realtime docket data.

  2. Start SocketIO server,add load 10K socket connections,now open Admin UI,it will take long to connect and then page became unresponsive.

Screenshot from 2021-07-07 00-05-10

darrachequesne commented 3 years ago

Yes, that's a lot of updates for the UI, which makes it unsuitable for more than a thousand connections.

We could add a lazy mode, where specific sockets/rooms are not tracked. WDYT?

vishwassingh47 commented 3 years ago

Yes instead of broadcasting each and every events, we could make it lazy loaded or support batch operations. That way it can handle Very Large Number of connections.

md-seb commented 3 years ago

Yes, that's a lot of updates for the UI, which makes it unsuitable for more than a thousand connections.

We could add a lazy mode, where specific sockets/rooms are not tracked. WDYT?

I think the server should not push, but client should pull instead, whenever the UI thinks it's ready. Updating every 2 secs is perhaps too fast anyway - items are jumping around too fast on screen when there's a lot of activity. Maybe 5 seconds would be better as a minimum?

Here's my idea for lazy mode. I call it the Adaptive Refresh. Configure minRefresh speed to e.g. 5000ms and refreshRatio to e.g. 1.2 UI sends a refresh request to the server and measures the roundtrip UI refreshes screen UI creates setTimeout for the next refresh to be Math.min(roundtrip*refreshRatio, minRefresh)

This should solve the following issues: Fix the original issue where the overwhelmed UI crashes. Self-adapt to server load, because server fetching updates from cluster and/or Redis are async, and can take a while. Self-adapt to response size, depending on WebSocket activity.

hatemragab commented 2 years ago

Are any updates about this issue?

darrachequesne commented 2 years ago

For future readers:

You can now use the production model, which was implemented in https://github.com/socketio/socket.io-admin-ui/commit/e0d91cadb11205c5f2c686c239a50cb2eef9795d and included in version 0.4.0.

In this mode, the server send fewer data to the admin UI, so it is suitable for a bigger workload.

Please reopen if needed!