johsely
Posts: 3
Joined: Fri Jun 28, 2019 11:14 am

ZMQ Context creation very slow

Fri Jun 28, 2019 11:27 am

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.

blimpyway
Posts: 186
Joined: Mon Mar 19, 2018 1:18 pm

Re: ZMQ Context creation very slow

Sun Jun 30, 2019 9:57 pm

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.

johsely
Posts: 3
Joined: Fri Jun 28, 2019 11:14 am

Re: ZMQ Context creation very slow

Fri Jul 05, 2019 6:57 am

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.

johsely
Posts: 3
Joined: Fri Jun 28, 2019 11:14 am

Re: ZMQ Context creation very slow

Thu Jul 11, 2019 1:40 pm

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.

Return to “Networking and servers”