Re: [Neo4j] HA Consistency

2011-08-23 Thread Peter Neubauer
Dave,
the HA MBean, see
http://docs.neo4j.org/chunked/snapshot/operations-monitoring.html is
giving you information about what instance currently being master, so
you can use that information to set up your load balancing. Would that
work?

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Sat, Aug 20, 2011 at 2:55 AM, David Rader
dra...@allianceglobalservices.com wrote:
 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 tuure.laurino...@portalify.com
 Subject: Re: [Neo4j] HA consistency
 To: Neo4j user discussions user@lists.neo4j.org
 Message-ID: 4d3381ef-89dc-402f-9efe-77d72131e...@portalify.com
 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
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] HA consistency

2011-08-19 Thread Tuure Laurinolli

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
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] HA Consistency

2011-08-19 Thread David Rader
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 tuure.laurino...@portalify.com
Subject: Re: [Neo4j] HA consistency
To: Neo4j user discussions user@lists.neo4j.org
Message-ID: 4d3381ef-89dc-402f-9efe-77d72131e...@portalify.com
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
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] HA consistency

2011-08-18 Thread David Rader
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?

How much overhead is there If you set the poll interval to a low duration, 1 
sec or less?

Thanks for your help

David Rader 
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user