My app runs on DO Ubuntu droplet, using django + gunicorn + nginx. What it basically does is when somebody loads the page, it makes a lot of requests to third-party API(which is very fast). It is supposed to make ~300 requests in several seconds(how it works on my local computer), but now I tried it with just 30 request and it already takes 6 seconds. How can I speed it up?
I use requests library. I tried multiprocessing to parallelize the code, but it says that I have only one CPU on DO. Moreover I took a look at stats and found out that it takes only ~0.01 Mbps so it’s not DO restriction.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.