pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.17k stars 166 forks source link

Subscriber Receiving packets very slowly #159

Closed Pramod-Devireddy closed 4 years ago

Pramod-Devireddy commented 4 years ago

Hi, the RecvBytes(0) function which I'm using inside goroutine is taking a lot of time to read messages. The publisher(c++) is sending messages continuously for every 10ms. The subscriber which is implemented in golang is taking sometimes more than 200ms to read. Due to which I'm experiencing packet losses.

start := time.Now()
contents, _ := Subscriber.RecvBytes(0)
elapsed := time.Since(start)
fmt.Printf("Execution Time: %s \n", elapsed)

Am I missing something?

Pramod-Devireddy commented 4 years ago

This behaviour is due to a lot of subscription filters. If I subscribe with empty filter then all the messages are received immediately without any delay.