goczmq
goczmq copied to clipboard
REQ socket in parallel benchmark
Hi
Can you please help me understand why when I try to send and receive messages with a REQ socket in parallel I receive the error: send frame error
?
Here is my snippet:
func BenchmarkCZmqParalel(b *testing.B) {
client := goczmq.NewReqChanneler(fmt.Sprintf("tcp://127.0.0.1:%d", czmq_port))
go func() {
err := <-client.ErrChan
b.Fatal(err)
}()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
client.SendChan <- [][]byte{[]byte("Message")}
<-client.RecvChan
}
})
}
Many thanks in advance