Question

I am playing with Riak 1.4.7 in order to get an insight about its characteristics.

As I know the recommended best practice mode of production Riak operation suggests placing Riak behind a load balancing. For this purpose, we can use HAProxy.

Can you tell me how can we ensure strong consistency (R=Q, W=Q)?

For example, let's assume I have a Riak cluster consists of 3 nodes. My Riak Java Driver based client communicates with the ring via HAProxy. What happens if the client wants to write entries w=quorum? How can the client be sure that at least two nodes confirmed the write if it only communicates with the HAProxy? I would assume that my client would think as it only communicated with a 1-node Riak cluster. Therefore it can never be sure how many Riak nodes confirmed the store operation. Is it correct or am I mistaken?

Was it helpful?

Solution

Regardless of whether the client is talking to a load balancer or directly to a server, the behavior is the same: the client is informed of Riak's result after the relevant number of servers have responded. The mechanics of that coordination are hidden from the client.

However, what Riak 1.4.x offers is not strong consistency, no matter how many servers are specified via the R and W values. Riak prioritizes availability, so if W=3 and only one server is available, that server will write 3 copies to itself and respond with success. If that server fails as the others come back online, clients will see an older value for that key.

With Riak 2.0, strong consistency will be an option.

For more on the pre-2.0 behavior, see http://littleriakbook.com.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top