-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request-response cycle does NxN work when it could do Nx1 #407
Comments
I've added a draft PR^ showing how the approach would work. It could certainly be made cleaner, especially around the finaliser stuff. It could be made backwards compatible by counting the number of subs on the response channel, if that value is non-zero then fall back to the old behaviour. |
Ping @darrachequesne |
Previously, a request would be sent to all listening nodes, on channel `${key}-request#${nsp}#` (e.g. "socket.io-request#/#"), and the other nodes would respond on a common channel `${key}-response#${nsp}#`, so every node get the response, instead of only the requesting node. This commit adds a new option: "publishOnSpecificResponseChannel". If it's set to true, then the other nodes will now respond on `${key}-response#${nsp}#${uid}#`, which is the channel specific to the requesting node, thus reducing the noise for the other nodes. To upgrade an existing deployment, users will need to upgrade all nodes to the latest version with publishOnSpecificResponseChannel = false, and then toggle the option on each node. Note: the option will default to true in the next major release Related: #407
Implemented in f66de11. |
@darrachequesne should we change the default Currently this config is still |
@dr-js yes, we totally could, though that would be a breaking change. Since this would trigger a new major release, we could even make it the default and remove the |
I would suggest a new major release, as this should reduce response count massively when using And in release changelog we could tell existing user to enable the option and gain possible performance. |
@darrachequesne after some cluster mode testing with |
I noticed that when a request for all sockets is issued every client gets the request (expected), and every client gets the response (hmmm?). The clients getting every response means we're consuming NxN resources for something that could be done with N.
socket.io-redis-adapter/lib/index.ts
Line 195 in 3242d8e
This seems to be because the response channel is singular^. A path forward could be to have the request originator start listening on a channel associated with the request id then have the responses come through this temporary channel.
The text was updated successfully, but these errors were encountered: