Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How often does python-requests perform dns queries

We are using Locust to for load testing rest api services behind elastic load balancing. I came across this article regarding load balancing and auto scaling, which is something we are testing.

Locust is using python-requests which is using urllib3, so my question is if python-requests does a dns query for every connect, and if not, is it configurable?

like image 961
djonsson Avatar asked Mar 18 '16 14:03

djonsson


People also ask

Does Python requests cache dns?

python-requests does a dns query for every connect. To disable this you can use a dns cache .

What is dns query in Python?

Domain Name System also known as DNS is a phonebook of the internet, which has related to the domain name. DNS translates the domain names to the respective IP address so that browsers can access the resources. Python provides DNS module which is used to handle this translation of domain names to IP addresses.


1 Answers

Locust is using python requests that is using urllib3 that is using socket.getaddrinfo which has DNS caching disabled according to this SO thread (given that your test machine runs linux).

like image 172
djonsson Avatar answered Oct 01 '22 02:10

djonsson