Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking for proxy settings will slow down the default http client #1044

Closed
myzhan opened this issue Jul 10, 2019 · 2 comments
Closed

Looking for proxy settings will slow down the default http client #1044

myzhan opened this issue Jul 10, 2019 · 2 comments

Comments

@myzhan
Copy link
Contributor

myzhan commented Jul 10, 2019

Description of issue

I found this issue, and started to find out why. Althought many reasons have impacts on performance, I think I have found one.

The test script is simple.

from locust import HttpLocust, TaskSet, task

class UserBehavior(TaskSet):
    @task(2)
    def index(self):
        self.client.get("/")

class WebsiteUser(HttpLocust):
    host = "http://localhost:8080"
    task_set = UserBehavior

Starting with a single slave, and run dtruss on my macbook to have a look at the system calls. Then I found many not-so-related system calls.

stat64("/Users/myzhan/_netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/.netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/_netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/.netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/_netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/.netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/_netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/.netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/_netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2
stat64("/Users/myzhan/.netrc\0", 0x7FFEE8209FB0, 0x0)		 = -1 Err#2

By default, requests will looking for proxy settings, that's why these system calls show up.

By setting session.trust_env to False to disable the feature, the RPS increased from 400 to 700.

Expected behavior

Disable proxy by default, provide options to enable if needed.

Actual behavior

Environment settings

  • OS: macOS Mojave
  • Python version: 3.7.3
  • Locust version: master branch
@cgoldberg
Copy link
Member

cool.. can you create a PR for that?

@myzhan
Copy link
Contributor Author

myzhan commented Jul 11, 2019

working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants