Page 1 of 1

ZMQ Context creation very slow

Posted: Fri Jun 28, 2019 11:27 am
by johsely
I use python ZeroMQ on my raspberry. The raspberry is configured as WIFI access point and the laptop connects to it. On the raspberry there is the publisher that sends out the data.

When I start the raspberry the wifi AP shows up fast and I can connect and ssh to it. Then I start my python script on the raspberry which starts the ZMQ stuff. I automatically start a ZMQRouter on the raspberry which starts also fast.

But the python script takes very long (up to 2 minutes) to boot up. I found that the time is spent in this line:

Code: Select all

self.context = zmq.Context()
Maybe it could also be this line:

Code: Select all

self.socket = self.context.socket(zmq.DEALER)
I create a ZMQ dealer there, so this is the init method of the dealer.

The thing is that if I just wait 2 minutes and start the script then, it works out without the delay.

So it seems the zmq method is waiting for something on the raspberry? I don't really get it because the network connection already seems to be working fine.
What I also realized is, that if I use an ethernet cable connected to the raspberry this problem does not happen.

Re: ZMQ Context creation very slow

Posted: Sun Jun 30, 2019 9:57 pm
by blimpyway
I ran this code and there was no delay.
I'd rather suspect some problems with network config on pi host / wifi / router ...

e.g. this kind of delayed network initialisation happens when an app tries to resolve a name to an IP address and it can not.

Of course there could be many other reasons.

Re: ZMQ Context creation very slow

Posted: Fri Jul 05, 2019 6:57 am
by johsely
Yes but I am actually using the localhost IP, so I tried 127.0.01 or the actual adress 192.168.4.1
Both ways are not working.
It just has to connect locally to the zmq router that is running on port 4000.

Re: ZMQ Context creation very slow

Posted: Thu Jul 11, 2019 1:40 pm
by johsely
I updated the zeroMQ to 4.3.2 and now it seems to work fine.
I had to compile it on the raspberry pi that took some time but it worked.