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

Request time doesn't include download time. #162

Closed
bradleyayers opened this issue May 26, 2014 · 7 comments
Closed

Request time doesn't include download time. #162

bradleyayers opened this issue May 26, 2014 · 7 comments

Comments

@bradleyayers
Copy link

From my testing it seems like the time reported by locust doesn't include the download time of the response. This assumes that the server only begins sending the response after the entire response is buffered.

I couldn't find anything in the documentation to clarify what the expected behaviour is.

@fordhurley
Copy link
Contributor

Is it possible that you're passing stream=True to the client.get call? If so, then you definitely aren't including downloading the content in timing. By default, this is False, so that time should be included in the reported time. stream is passed through to requests, which uses it like so.

Got this by looking at the locust and requests code, so I could be wrong.

@Jahaja
Copy link
Member

Jahaja commented Jul 12, 2014

Closing this as no further response was given. Furthermore, Locust uses non-streaming requests by default.

@Jahaja Jahaja closed this as completed Jul 12, 2014
heyman added a commit that referenced this issue Sep 6, 2014
@heyman
Copy link
Member

heyman commented Sep 7, 2014

I added a test in f05ff7f which shows that this is a real issue. I didn't realize it at first, since I was running requests 2.2, but saw that the build failed on Travis.ci (https://travis-ci.org/locustio/locust/builds/34592126). The test starts failing with requests 2.3. I haven't had time to investigate what might have changed yet.

If anyone is affected by this right now, a work-around is to downgrade to requests 2.2.

There's also a few other tests that fail because of ProtocolError exception being raised. This is however a bug in requests 2.4 which has now been fix: https://github.com/kennethreitz/requests/pull/2193

@heyman heyman reopened this Sep 7, 2014
@Jahaja
Copy link
Member

Jahaja commented Sep 7, 2014

I guess you mean https://travis-ci.org/locustio/locust/builds/34596048? The streaming test is currently failing on AttributeError: 'TestHttpSession' object has no attribute 'assertGreater'.

Edit: Ah, I just looked at the first one which is 2.6 that does not come with assertGreater.

@heyman
Copy link
Member

heyman commented Sep 7, 2014

Ah, that's the python 2.6 test suite that is failing because of that. The 2.7 one (https://travis-ci.org/locustio/locust/jobs/34596050) is "a real" failure because the content download time is not included in the response time (with requests 2.3 and 2.4).

I've fixed the issue under python 2.6 in e18bf5c.

@Jahaja
Copy link
Member

Jahaja commented Sep 7, 2014

Yeah, looks like it. Nice find.
We could use unittest2 instead of copying the methods as we already includes it in the tests_require option in setup.py.

@heyman
Copy link
Member

heyman commented Sep 7, 2014

@Jahaja: Ah, okay. Yeah, that sounds better :).

Since this issue is caused by changed behaviour in requests, I've created an issue (with a similar test included) there (https://github.com/kennethreitz/requests/pull/2209). I believe the changed behaviour in requests was unintended, but if it turns out it wasn't I guess we might want to do some work-around in Locust.

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

4 participants