0

I'm working on a TTS app using AWS Polly in Raspberry PI 3 B+ and when I post a text using Python requests it take a long time receive the response, around 16-17 seconds. This happens only with a certain wifi connection. I have tried 3 different wifi connections in which 2 of them are mobile hot spots and the request.post gives a response within 2 seconds. When I connect to a wifi modem which is a 4G/5G connection it takes around 16-17 seconds. Modem speed is not an issue here as it gives minimum 120Mbps speed. Pi connects only with the 4G connection here not 5G. I have enabled the "Disable IPV6" option in in the wifi settings. Why it's slow only with a certain connection which is a faster network?

import requests
import time

start = time.time()
res = requests.post('https://myawsAPI_XXXXXXX', json={"body":"Activate barn door protocol."})
print("Elapsed time1:", time.time() - start)

Blockquote

Elapsed time1: 17.350016117095947

1 Answer 1

1

I figured out the problem here. I had to disable the Ipv6 in the pi sysctl.conf.

To disable ipv6, you have to open /etc/sysctl.conf using any text editor and insert the following lines at the end:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

and reboot. If IPv6 is still not disabled, then the problem is that sysctl.conf is still not activated. To solve this, type the command:

sudo sysctl -p

You will see this in the terminal:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

After that, if you run:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1

If you see 1, ipv6 has been successfully disabled. For other methods please check this page.

1
  • You should also mark your answer as the answer to your question
    – MatsK
    Commented Jan 11, 2023 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.