On 08/02/17 17:01, 沈林 wrote:
> Hi, Bela:
>
>
> Thank you for answering my questions. The two demos of read/write you
> provided is very useful to me. The current problem is read:
>
>
> As you said :
>
> 1) The ReplicatedStateMachine demo have to live with stale
> reads.(Beacuse of reading from the local map directly, without leader)
Right, but note that this is just a demo. Once could implement non-stale
reads the way I described it.
> 2) The CounterService demo takes high cost of reads. (Because each read
> must be led by leader. This problem will be more serious When
> the cluster is bigger ,such as 10 nodes or more, with high read and low
> write.)
Correct.
> As previously said,I want to build a distributed storage system which
> possesses the features of high read, low write, and strong consistency.
> Can it be bring about ? (In order to ensure the performance of read,
> reading from the local storage, not from the centralized cache , or from
> other machine by hash algorithm , is a good way I think,especially in a multi-room environment or weak
> network)
It depends on what properties you want in your system; in my previous
reply I assumed you wanted to execute reads in exactly the same sequence
as writes. Of course, if you're willing to live with properties that are
less strict, e.g. read-your-writes, performance will be better.
Read-your-writes means the read is sent to the leader, and you would see
your previous write, or a write by someone else. This would not involve
a disk read and no consensus, so it will be faster.
If you read Diego's Raft thesis, he describes how to do reads, but this
part hasn't been implemented in jgroups-raft (yet).
> Another question is that the ReplicatedStateMachine demo is based on
> jgroups-raft when updating the data.
>
> But I think it also can just only rely on the jgroups to achieve it.
> (Using jgroups to notify all the nodes to update the data reliably)
Sure, but as I said, it depends on your consistency requirements. For
example, are you able to tolerate inconsistent data on network
partitions? If that's the case, and your application is able to merge
data after a partition heals, then use JGroups. If not, use jgroups-raft.
> So what is the advantages of jgroups-raft on the ReplicatedStateMachine
> demo comparing to the jgroups?
- Changes are only applied by (majority) agreement, as a consequence
- Data never diverges, even under network partitions
- All changes are applied in total order
> > <
http://www.baidu.com/link?url=w- <
http://www.baidu.com/link?url=w->
> > an email to
jgroups-raft...@googlegroups.com <javascript:>
> > <mailto:
jgroups-raft...@googlegroups.com <javascript:>>.
> <javascript:>
> > <mailto:
jgroup...@googlegroups.com <javascript:>>.
> <
https://groups.google.com/d/msgid/jgroups-raft/cc33c266-ddcc-4474-8b7e-5310c1cd38e0%40googlegroups.com?utm_medium=email&utm_source=footer
> <
https://groups.google.com/d/optout>.
> --
> You received this message because you are subscribed to the Google
> Groups "jgroups-raft" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
jgroups-raft...@googlegroups.com
> <mailto:
jgroups-raft...@googlegroups.com>.
>
https://groups.google.com/d/msgid/jgroups-raft/09909dfc-cad2-415c-8aa9-45ac5aef3fff%40googlegroups.com
> <
https://groups.google.com/d/msgid/jgroups-raft/09909dfc-cad2-415c-8aa9-45ac5aef3fff%40googlegroups.com?utm_medium=email&utm_source=footer>.