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

Locust starts throwing failures when users > 130 (OS X) #496

Closed
rafalf opened this issue Nov 3, 2016 · 11 comments
Closed

Locust starts throwing failures when users > 130 (OS X) #496

rafalf opened this issue Nov 3, 2016 · 11 comments

Comments

@rafalf
Copy link

rafalf commented Nov 3, 2016

I got locust installed on Macbook Air
The test is very basic, only one page is tested:


from locust import HttpLocust, TaskSet, task

class UserBehavior(TaskSet):
    def on_start(self):
        pass

    @task
    def profile(self):
        self.client.get("/nonprofit/ifrc/articles/125585")

class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait=5000
    max_wait=15000

and the user load is very small obviously.

GET /nonprofit/ifrc/articles/125585 ConnectionError(MaxRetryError("HTTPConnectionPool(host='www.qammado.com', port=80): Max retries exceeded with url: /nonprofit/ifrc/articles/125585 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x10ad788d0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))",),)

@rafalf
Copy link
Author

rafalf commented Nov 3, 2016

image

@heyman
Copy link
Member

heyman commented Nov 3, 2016

Hmm, that sounds like a DNS error. What happens if you use the IP-address as host (and set the Host header manually, if needed)?

@rafalf
Copy link
Author

rafalf commented Nov 3, 2016

DNS is Route 53 and I don't thing that's the issue as I could run 250-500 concurrent users using other tools. I cannot simply use IP address as a host because there's an nginx box in front of it and its serving 3 different sites.

and set the Host header manually, if needed)?
where would I do that with my current setup?

@rafalf
Copy link
Author

rafalf commented Nov 3, 2016

i might have found something, there is another failure down the log... too many open files

@heyman
Copy link
Member

heyman commented Nov 3, 2016

where would I do that with my current setup?

self.client.get("/nonprofit/ifrc/articles/125585", headers={"host":"my-custom-domain"})

@heyman
Copy link
Member

heyman commented Nov 3, 2016

i might have found something, there is another failure down the log... too many open files

Ah, that's probably it (http://docs.locust.io/en/latest/installation.html#increasing-maximum-number-of-open-files-limit). You should increase the maximum number of open files. I don't remember exactly how to do it in OSX but it should be easy to google it.

@rafalf
Copy link
Author

rafalf commented Nov 3, 2016

yes that's the problem ! thanks. Just in case if someone stumble upon the same issue the command is:
ulimit -S -n 1024
there are other ways of setting it up as well
closing it

@rafalf rafalf closed this as completed Nov 3, 2016
@rafalf
Copy link
Author

rafalf commented Nov 3, 2016

@heyman - in fact there were 2 issues and using ip address along with passing the header fixes the original issue reported

ConnectionError(MaxRetryError("HTTPConnectionPool(host='www.qammado.com', port=80): Max retries exceeded with url: /nonprofit/ifrc/articles/125585 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x10ad788d0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))",),)

@ghost
Copy link

ghost commented Jan 25, 2017

@rafalf typo on it! the correct code is ulimit -S -n 1024

@DataGreed
Copy link

I have the same errors on macOS, but when I type ulimit in the terminal t outputs unlimited, so I guess there is something else going on.

Is there any way to fix it? Same config - Route53, arounf 20% of requests failing with

ConnectionError(MaxRetryError("HTTPSConnectionPool(host=\'REDACTED\', port=443): Max retries exceeded with url: /v1/redacted (Caused by NewConnectionError(\'<urllib3.connection.VerifiedHTTPSConnection object at 0x1139ffc18>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known\'))"))'

@DataGreed
Copy link

Oops, my bad.

The proper way to check for number of file descriptors on MacOS currently is:

ulimit -n

or you can use this to see all limits:

ulimit -a

Mine was 256, changed it to 4096 and the issue was resolved:

ulimit -n 4096

Note: changes don't persist and last current terminal session only.

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

3 participants