In order to configure a load balancer to target all reads or all writes to the master in an HA - what's the best way to do this?
For instance, if you had a single source of updates and many clients reading you might want to load balance the slaves as read-only and have the updates all flow to the master node. Since the master is elected and will change after a crash, what's the best way to "see" which node is the master and dynamically update a load balancer to correctly direct traffic? Or, what's the best way to update DNS entries to point to a master.neocluster.company.com vs. slave.neocluster.company.com or such? Thanks Dave Date: Fri, 19 Aug 2011 11:12:05 +0300 From: Tuure Laurinolli <[email protected]> Subject: Re: [Neo4j] HA consistency To: Neo4j user discussions <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset=us-ascii On Aug 19, 2011, at 07:57 , David Rader wrote: > It looks like the HA implementation is for eventual consistency, tunable by > how often a slave polls the master for updates from other nodes. > > With a load balanced cluster, is the best practice to simply use sticky > sessions on clients to ensure that immediate reads of updated data are served > by the same node that wrote the update and are therefore consistent? Any > other recommended approaches? If your goal is HA, there are two other approaches: 1) Always read from master and 2) Always take read lock on things you read Always reading from master works because writes are synchronously replicated to master, and taking a read lock works because taking a read lock always synchronizes with master (although it of course also disallows related writes for the duration of your transaction). These solutions affect write performance (reading from master consumes master capacity, and taking read locks prevents other transactions from completing). Read performance is certainly affected as well compared to sticky sessions, and is likely to be considerably lower because of the synchronization requirements, and load on master. Consistency guarantees would be as follows: - Reading from arbitrary slaves guarantees very little - Sticky sessions guarantee read-everything-up-until-your-previous-write - Reading from master guarantees consistency re: communications over side channels (if another node, after committing, tells you that he wrote something, you can see that write, or possibly some newer write) - Taking read locks guarantees read-everything-up-until-your-previous-lock-request and also repeatable reads _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

