-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Geventhttpclientmergeconflicts #838
Merged
mbeacom
merged 31 commits into
locustio:master
from
SpencerPinegar:geventhttpclientmergeconflicts
Sep 27, 2019
Merged
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
9a0bc33
Started implementing a new Locust HTTP client that uses geventhttpcli…
heyman 5de56c9
Added geventhttpclient to tests_require in setup.py. This makes the t…
heyman 9fd6621
Added geventhttpclient to tox.ini
heyman 0a8af7b
Python 2 fixes
heyman 84bb988
Use timeit.default_timer() instead of time.time()
heyman 255c76c
Added text property to Response objects returned by GeventHttpSession…
heyman cce8c66
Fixed wrong link target
heyman 0351db8
Renamed GeventHttpLocust -> FasHttpLocust and GeventHttpSession -> Fa…
heyman f1e5761
Renamed files
heyman a33a4f5
Fixed import
heyman 7fb8dd5
Renamed response class
heyman c5e0618
Added FastHttpSession.patch()
heyman 5f464a1
Started writing docs for FastHttpLocust
heyman 5116f30
Updated test that accidentally broke
heyman 9ed5623
Minor RST syntax fix
heyman e8c87ac
Check that the given FastHttpLocust.host is valid and doesn't contain…
heyman 0f0d047
Implemented support for using the catch_response argument when making…
heyman 064f5e0
Implemented support for HTTP Basic Auth in FastHttp client.
heyman 748ba8d
Typo
heyman a1a42f0
Fixed tests for manually failing an already failed request with catch…
heyman 03d436e
Removed commented out code
heyman 42bfffb
Clarified documentation about performance gains of FastHttpClient
heyman a8b8abd
Added HTTPConnectionClosed to "whitelisted" exceptions that should be…
heyman 84b0579
Spelling typo
heyman f34dcac
Removed "Known limitations" (yay)
heyman f1dad45
Merge branch 'master' into geventhttpclient
heyman 7055334
Added dependency on PyPI package geventhttpclient-wheels
heyman 40aebc6
Removed geventhttpclient from tox dependencies
heyman a36adaf
Merge branch 'master' into geventhttpclientmergeconflicts
1171b9b
I was getting the assertionError 0.0 not greater than 0 -- I assumed …
72beb5b
Merge branch 'master' into geventhttpclientmergeconflicts
cgoldberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.. _increase-performance: | ||
|
||
============================================================== | ||
Increase Locust's performance with a faster HTTP client | ||
============================================================== | ||
|
||
Locust's default HTTP client uses `python-requests <http://www.python-requests.org/>`_. | ||
The reason for this is that requests is a very well-maintained python package, that | ||
provides a really nice API, that many python developers are familiar with. Therefore, | ||
in many cases, we recommend that you use the default :py:class:`HttpLocust <locust.core.HttpLocust>` | ||
which uses requests. However, if you're planning to run really large scale scale tests, | ||
Locust comes with an alternative HTTP client, | ||
:py:class:`FastHttpLocust <locust.contrib.fasthttp.FastHttpLocust>` which | ||
uses `geventhttpclient <https://github.com/gwik/geventhttpclient/>`_ instead of requests. | ||
This client is significantly faster, and we've seen 5x-6x performance increases for making | ||
HTTP-requests. This does not necessarily mean that the number of users one can simulate | ||
per CPU core will automatically increase 5x-6x, since it also depends on what else | ||
the load testing script does. However, if your locust scripts are spending most of their | ||
CPU time in making HTTP-requests, you are likely to see signifant performance gains. | ||
|
||
|
||
How to use FastHttpLocust | ||
=========================== | ||
|
||
First, you need to install the geventhttplocust python package:: | ||
|
||
pip install geventhttpclient | ||
|
||
Then you just subclass FastHttpLocust instead of HttpLocust:: | ||
|
||
from locust import TaskSet, task | ||
from locust.contrib.fasthttp import FastHttpLocust | ||
|
||
class MyTaskSet(TaskSet): | ||
@task | ||
def index(self): | ||
response = self.client.get("/") | ||
|
||
class MyLocust(FastHttpLocust): | ||
task_set = MyTaskSet | ||
min_wait = 1000 | ||
max_wait = 60000 | ||
|
||
|
||
.. note:: | ||
|
||
FastHttpLocust uses a whole other HTTP client implementation, with a different API, compared to | ||
the default HttpLocust that uses python-requests. Therefore FastHttpLocust might not work as a d | ||
rop-in replacement for HttpLocust, depending on how the HttpClient is used. | ||
|
||
|
||
API | ||
=== | ||
|
||
FastHttpSession class | ||
===================== | ||
|
||
.. autoclass:: locust.contrib.fasthttp.FastHttpSession | ||
:members: __init__, request, get, post, delete, put, head, options, patch | ||
|
||
.. autoclass:: locust.contrib.fasthttp.FastResponse | ||
:members: content, text, headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.