Reputation: 2222
I want to synchronize changes to a certain Javascript object such that several node.js instances have a consistent representation of that object.
Each instance can freely change its local copy of the object (add properties, remove properties, change values) and these changes must be replicated to the other instances. Instances are all connected by socket communication.
What are some methods I can use for data replication?
(Don't worry about detecting changes to the synced object. It is placed behind a proxy with getters/setters that can capture and handle any changes).
Upvotes: 0
Views: 2987
Reputation: 68335
I would say that replication is very dependent on a single node architecture. However probably one of the best solution to deal with data replication (if your node data can be stored/serialized elsewhere) is to use tool/database which have this functionality built-in (for example Redis) so that you won't spend time creating something that others have already proven and tested (unless you want some hard-code action).
Upvotes: 1