goczmq icon indicating copy to clipboard operation
goczmq copied to clipboard

REQ socket in parallel benchmark

Open Trial97 opened this issue 5 years ago • 0 comments

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

Trial97 avatar Nov 01 '19 09:11 Trial97