How often does python-requests perform dns queries

2019-02-18 11:59发布

问题:

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?

回答1:

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).