StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.87k stars 1.51k forks source link

Ignore self sent message in an auto scaled cloud environment #2549

Closed ap-81 closed 8 months ago

ap-81 commented 12 months ago

I have the application running on Azure cloud with auto scaling turned on. How can I ignore the self message, given the number of servers can change dynamically?

This issue (#859) talks about a similar scenario but the number of servers are static, so the names could be pre-assigned in order to identify each server.

mgravell commented 12 months ago

With the exception of server-assisted client caching: that isn't a scenario supported by the server, and the library tries to stay "pure" (meaning: no opinionated convention things - users can add their own). I have a branch for the server-assisted caching: "in progress" - so if you're using server v6 or above, waiting on that is probably the best move.

mgravell commented 12 months ago

If that isn't an option, for a convention based approach: pick a guid at the start of your process, and prefix all messages with your own guid. Ignore any messages that start with your own guid.

NickCraver commented 8 months ago

Closing out to tidy up!