Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[network] increase pubsub message buffers #210

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions network/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const (
subscribeOutputBufferSize = 1024
)

// max worker number (min 1 and max 32)
var workerNum = int(common.Min(common.Max(uint64(runtime.NumCPU()), 1), 32))
// max worker number (min 2 and max 64)
var workerNum = int(common.Min(common.Max(uint64(runtime.NumCPU()), 2), 64))

type Topic struct {
logger hclog.Logger
Expand Down Expand Up @@ -74,7 +74,7 @@ func (t *Topic) readLoop(sub *pubsub.Subscription, handler func(obj interface{})
ctx, cancelFn := context.WithCancel(context.Background())
defer cancelFn()

workqueue := make(chan proto.Message, workerNum)
workqueue := make(chan proto.Message, workerNum*4)
defer close(workqueue)

t.wg.Add(1)
Expand Down
2 changes: 1 addition & 1 deletion network/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
// validateBufferSize is the size of validate buffers in go-libp2p-pubsub
// we should have enough capacity of the queue
// because when queue is full, validation is throttled and new messages are dropped.
validateBufferSize = 1024
validateBufferSize = subscribeOutputBufferSize * 2
)

const (
Expand Down