feat: RedisServerAffinity RFC: Lock one document to one server - #1008
feat: RedisServerAffinity RFC: Lock one document to one server#1008mattkrick wants to merge 4 commits into
Conversation
Signed-off-by: Matt Krick <matt.krick@gmail.com>
|
@janthurau would love some feedback if this is something you'd consider |
|
Hi @mattkrick, sorry for the long silence. We don't have any real issues (even on really large instances with 100k connections) with documents being open on multiple servers, apart from the known fact that it creates the cpu / memory load multiple times. I am not sure if proxying solves all issues or even creates some new ones, because if you load-balance with different regions to keep latency short, proxying to another region would even increase latency. I had a concept of just maintaining the cluster somehow and then creating a.collab.yourdomain.com, b.collab.yourdomain.com, etc. which each routes to a single instance. If a request comes in at the "wrong" instance, it could return a 301 to the new hostname. However, this is more complex to maintain and also has the same latency issue. Are you currently running this in production? Do you face issues without / with it? Right now I think this is nothing that I want to maintain :) Obviously feel free to publish the extension and we can link to it from the README. |
|
Wow! If it's working with 100k connections, then I completely understand not wanting to change strategies. We're currently running this in production both in a cloud SaaS (~10k active connections) as well as a handful of airgapped HA deployments and it's worked well! |
Follow-up to #983
This extension guarantees that 1 document is only open on a single server at any given time. If a client attempts to access a document that is already opened on a different server, their messages get proxied to that server via Redis.
If a server needs to lock a document (e.g. before calling
openDirectConnection), it can call thelockDocumentmethod. Alternatively, it may use this extension like an event emitter that emits to the owning server viacustomEventsand thehandleEventmethod.May be of interest to @0xb4lamx @janthurau