0

On my raspberry pi, I run a python flask http request that takes a few seconds to complete. When I ask the request from my computer to the raspberry pi while connected to my phone hotspot, the request is taking a few seconds and completes normally.
However, when I execute the request from my computer to the raspberry pi while connect to the raspberry pi directly, in Access Point mode, the response is either very slow to arrive or the request never completes. I know that the request was well received and treated on the raspberry pi because of print statements, it is only the response that is not going through properly.

I suspect it is more a networking issue on the raspberry pi access point mode rather than an issue with the flask server. Note that all the other endpoints of the flask server (that do not take time to complete) are working as intended on both situations.

Do you have an idea of why the longer requests do not complete ?

asked Mar 21 at 15:09
5
  • I think it can depend on what version of the Pi or the exact hardware involved, but yes the AP mode can throttle speed pretty dramatically. It may just be CPU/IO-intensive, slowing down the webservice enough to cause issues? Some people have better luck with different USB wifi adapters. If you want to troubleshoot it further, you could use a tool like iperf to test network speeds and maybe rule out flask being the cause Commented Mar 21 at 18:00
  • @Cpt.Whale ty for that, Yets it's the Raspberry Pi 5 4GB ram (no wifi adapters), the size of the response payload is really not big (a few KB) so idk. It is indeed CPU & IO intensive activity done on the server during the request but once the computation is completed the response should be delivered directly right? Commented Mar 23 at 8:41
  • It looks a bit like just running in AP mode can cause quite a bit of additional CPU usage, likely due to poor firmware/drivers. Some people only have noticeable issues when running in dual mode (both a wifi client and AP, like if extending a wifi network). Hard to tell if it's really related to your issue though. You could troubleshoot the networking further with tcpdump/wireshark, but it could be as simple as some internet request needing to time out before the response goes (I assume it has internet access on your phone hotspot). Depends how else you've tested it out Commented Mar 24 at 20:23
  • @Cpt.Whale I don't think it is CPU usage related as under normal operations it takes 2-3 seconds to complete and in AP mode it takes more than 10 or never does. It is very interesting your supposition about an internet request needing to time out before response goes, that would make a lot of sense (as no internet in AP mode). However, I don't think I perform an internet request, maybe another module/package does... I will try to look into that using Wireshark. Commented Mar 25 at 8:20
  • @Cpt.Whale After checking, the issue does not happen when using Wi-Fi mode from a phone hotspot without an internet connection :( Meaning the hypothesis of a request timeout probably wasn't correct, unfortunately. Commented Mar 25 at 8:44

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.