rafthttp: batch MsgProp

If amounts of MsgProp goes to the follower, it could batch them and
forward to the leader. This can avoid dropping MsgProp in good path
due to exceed maximal serving in sender.

Moreover, the batch can increase the throughput of proposals that come
from follower.

/cc @xiang90 @bdarnell
Understand. It is great to have another goroutine to handle this. I am also
thinking about using certain connection for it like zk. I 'd like to
improve it when refactoring rafthttp

On Wednesday, December 10, 2014, Xiang Li <notifications@github.com> wrote:

> In rafthttp/sender.go
> <https://github.com/coreos/etcd/pull/1901#discussion-diff-21650403>:
>
> > @@ -136,16 +139,33 @@ func (s *sender) Send(m raftpb.Message) error {
> >  		s.initStream(types.ID(m.From), types.ID(m.To), m.Term)
> >  		s.batcher.Reset(time.Now())
> >  	}
> > -	if canBatch(m) && s.hasStreamClient() {
> > -		if s.batcher.ShouldBatch(time.Now()) {
> > -			return nil
> > +
> > +	var err error
> > +	switch {
> > +	case m.Type == raftpb.MsgProp:
> > +		s.propBatcher.Batch(m)
>
> i do not think it is clean to let other messageTyp to trigger sending a
> proposal in batch.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/coreos/etcd/pull/1901/files#r21650403>.
>