jsdelivr / globalping

A global network of probes to run network tests like ping, traceroute and DNS resolve
https://www.jsdelivr.com/globalping
226 stars 29 forks source link

perf: use a separate redis channel for each probe #495

Closed MartinKolarik closed 4 months ago

MartinKolarik commented 4 months ago

Uses a new feature of the adapter I added in https://github.com/MartinKolarik/socket.io-redis-adapter/tree/dynamic-private-2, which allows creating separate channels for private rooms (the original adapter only supports this for public rooms so far; if this works well, I'll make a PR to upstream).

The idea is similar to #429 but optimizes different parts - the socket.emit() and .to(socketId).emit() calls. The affected calls now result in 1/8 of the bandwidth compared to before, as the messages are sent only to one process, instead of all 8. I'll follow up with fetchSockets() optimization in another PR.

MartinKolarik commented 4 months ago

Looks like this reduced the redis load by another 50 - 60%