Skip to content

Commit

Permalink
[FAB-5153] Relax gossip send buffer behavior
Browse files Browse the repository at this point in the history
In gossip there are send and receive buffers that are
allocated for each connection.
When the throughput of messages is too high and the send buffer
overflows, the connection to the peer is closed and the peer is removed from the membership.

From performance evaluations I did - I conclude that:
- Increasing the send buffer size would benefit to withstand
  intense bursts of messages, even when the receive buffer stays the same.
- Not closing the connection to the peer (and not removing it from the membership)
  that its corresponding send buffer overflowed helps the throughput by giving the
  runtime an opportunity to recover in spite of an intensive burst.

Change-Id: I7bc84092e366b75b6cbcaee1ea9d5320274dfc1c
Signed-off-by: yacovm <[email protected]>
  • Loading branch information
yacovm committed Jul 3, 2017
1 parent bdd4a96 commit 4cd2a8c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions gossip/comm/comm_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@ const (
defConnTimeout = time.Second * time.Duration(2)
defRecvBuffSize = 20
defSendBuffSize = 20
sendOverflowErr = "Send buffer overflow"
)

var errSendOverflow = errors.New(sendOverflowErr)

// SetDialTimeout sets the dial timeout
func SetDialTimeout(timeout time.Duration) {
viper.Set("peer.gossip.dialTimeout", timeout)
Expand Down
2 changes: 1 addition & 1 deletion gossip/comm/comm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func TestViperConfig(t *testing.T) {
assert.Equal(t, time.Duration(2)*time.Second, util.GetDurationOrDefault("peer.gossip.connTimeout", 0))
assert.Equal(t, time.Duration(300)*time.Millisecond, util.GetDurationOrDefault("peer.gossip.dialTimeout", 0))
assert.Equal(t, 20, util.GetIntOrDefault("peer.gossip.recvBuffSize", 0))
assert.Equal(t, 20, util.GetIntOrDefault("peer.gossip.sendBuffSize", 0))
assert.Equal(t, 200, util.GetIntOrDefault("peer.gossip.sendBuffSize", 0))
}

func TestHandshake(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion gossip/comm/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ func (conn *connection) send(msg *proto.SignedGossipMessage, onErr func(error))
defer conn.Unlock()

if len(conn.outBuff) == util.GetIntOrDefault("peer.gossip.sendBuffSize", defSendBuffSize) {
go onErr(errSendOverflow)
return
}

Expand Down
2 changes: 1 addition & 1 deletion sampleconfig/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ peer:
# Buffer size of received messages
recvBuffSize: 20
# Buffer size of sending messages
sendBuffSize: 20
sendBuffSize: 200
# Time to wait before pull engine processes incoming digests (unit: second)
digestWaitTime: 1s
# Time to wait before pull engine removes incoming nonce (unit: second)
Expand Down

0 comments on commit 4cd2a8c

Please sign in to comment.