diff --git a/docs/configuration.rst b/docs/configuration.rst index 9d73c16bf5..002142b7ea 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -87,7 +87,7 @@ Customization of statistics settings Default configuration for Locust statistics is set in constants of stats.py file. It can be tuned to specific requirements by overriding these values. -To do this, import locust.stats module and override required settings +To do this, import locust.stats module and override required settings: .. code-block:: python diff --git a/docs/developing-locust.rst b/docs/developing-locust.rst index 070eb134c4..818e29a43a 100644 --- a/docs/developing-locust.rst +++ b/docs/developing-locust.rst @@ -9,7 +9,7 @@ You want to contribute to Locust? Great! Here is a list of `open bugs/feature re Install Locust for development ============================== -Fork Locust on `Github `_ and then run +Fork Locust on `GitHub `_ and then run .. code-block:: console @@ -53,7 +53,7 @@ Then you can build the documentation locally using: make build_docs -Then the documentation should be build and available at ``docs/_build/index.html`` +Then the documentation should be build and available at ``docs/_build/index.html``. diff --git a/docs/further-reading.rst b/docs/further-reading.rst index ced185f43d..5481ac84d7 100644 --- a/docs/further-reading.rst +++ b/docs/further-reading.rst @@ -22,4 +22,4 @@ You'll also find a lot of answers on `stackoverflow `_ +If you think Locust is missing some obvious feature (like stopping after a certain number of iterations/requests, setting goals/thresholds for when to fail a test run, support for additional User types like Kafka, Selenium/WebDriver etc), chances are it is implemented in `locust-plugins `_. diff --git a/docs/increase-performance.rst b/docs/increase-performance.rst index e20c51c9f9..0236316c27 100644 --- a/docs/increase-performance.rst +++ b/docs/increase-performance.rst @@ -32,7 +32,7 @@ Just subclass FastHttpUser instead of HttpUser:: .. note:: - FastHttpUser/geventhttpclient is very similar to for HttpUser/python-requests, but sometimes there are subtle differences. This is particularly true if you work with the client library's internals, e.g. when manually managing cookies. + FastHttpUser/geventhttpclient is very similar to HttpUser/python-requests, but sometimes there are subtle differences. This is particularly true if you work with the client library's internals, e.g. when manually managing cookies. API === diff --git a/docs/installation.rst b/docs/installation.rst index be7a4a1a6b..e2088ae1ec 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -3,7 +3,7 @@ Installation ============ -`Install Python `_ 3.7 or later, if you dont already have it. +`Install Python `_ 3.7 or later, if you don't already have it. Install Locust: diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 49ba61052a..9214556eae 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -4,7 +4,7 @@ Getting started =============== -A Locust test is essentially a Python program. This makes it very flexible and particularly good at implementing complex user flows. But it can do simple tests as well, so lets start with that: +A Locust test is essentially a Python program. This makes it very flexible and particularly good at implementing complex user flows. But it can do simple tests as well, so let's start with that: .. code-block:: python @@ -55,17 +55,17 @@ Number of users: .. note:: - Interpreting performance test results is quite complex (and mostly out of scope for this manual), but if your graphs start looking like this, the most likely reason is that your target service/system cannot handle the load you are hitting it with (it is overloaded or "saturated") + Interpreting performance test results is quite complex (and mostly out of scope for this manual), but if your graphs start looking like this, the most likely reason is that your target service/system cannot handle the load you are hitting it with (it is overloaded or "saturated"). The clearest sign of this is that when we get to around 9 users, response times start increasing so fast that the requests per second-curve flattens out, even though new users are still being added. - If you're having trouble generating enough load to saturate your system, or need some pointers on how to start digging into a server side problem have a look at the `Locust FAQ `_ + If you're having trouble generating enough load to saturate your system, or need some pointers on how to start digging into a server side problem have a look at the `Locust FAQ `_. Direct command line usage / headless ==================================== -Using the Locust web UI is entirely optional. You can supply the load parameters on command line and get reports on the results in text form: +Using the Locust web UI is entirely optional. You can supply the load parameters on the command line and get reports on the results in text form: .. code-block:: console :substitutions: @@ -100,4 +100,4 @@ To see all available options type: ``locust --help`` or check :ref:`configuratio | -Now, lets have a more in-depth look at locustfiles and what they can do: :ref:`writing-a-locustfile` \ No newline at end of file +Now, let's have a more in-depth look at locustfiles and what they can do: :ref:`writing-a-locustfile`. \ No newline at end of file diff --git a/docs/running-distributed.rst b/docs/running-distributed.rst index 2ba0ac4b9d..cd9ecbb6aa 100644 --- a/docs/running-distributed.rst +++ b/docs/running-distributed.rst @@ -64,7 +64,7 @@ Optionally used together with ``--worker`` to set the port number of the master ``--master-bind-host=X.X.X.X`` ------------------------------ -Optionally used together with ``--master``. Determines what network interface that the master node +Optionally used together with ``--master``. Determines which network interface the master node will bind to. Defaults to * (all available interfaces). ``--master-bind-port=5557`` @@ -118,7 +118,7 @@ order to coordinate data. This can be easily accomplished with custom messages u environment.runner.send_message('test_users', users) Note that when running locally (i.e. non-distributed), this functionality will be preserved; -the messages will simply be handled by the same runner that sends them. +the messages will simply be handled by the runner that sends them. A more complete example can be found in the `examples directory `_ of the Locust source code. @@ -139,5 +139,5 @@ See :ref:`running-distributed-without-web-ui` Increase Locust's performance ============================= -If you're planning to run large-scale load tests you might be interested to use the alternative -HTTP client that's shipped with Locust. You can read more about it here: :ref:`increase-performance` +If you're planning to run large-scale load tests, you might be interested to use the alternative +HTTP client that's shipped with Locust. You can read more about it here: :ref:`increase-performance`. diff --git a/docs/running-in-debugger.rst b/docs/running-in-debugger.rst index d9773ffbc3..94dc8b0d74 100644 --- a/docs/running-in-debugger.rst +++ b/docs/running-in-debugger.rst @@ -8,7 +8,7 @@ Running Locust in a debugger is extremely useful when developing your tests. Amo But debuggers sometimes have issues with complex gevent-applications like Locust, and there is a lot going on in the framework itself that you probably aren't interested in. To simplify this, Locust provides a method called :py:func:`run_single_user `: -Note that this is fairly new feature, and the api is subject to change. +Note that this is a fairly new feature, and the api is subject to change. .. literalinclude:: ../examples/debugging.py :language: python @@ -28,7 +28,7 @@ Make sure you have enabled gevent in your debugger settings. In VS Code's ``laun .. literalinclude:: ../.vscode/launch.json :language: json -There is a similar setting in `PyCharm `_ +There is a similar setting in `PyCharm `_. .. note:: @@ -36,4 +36,4 @@ There is a similar setting in `PyCharm `_ +You can execute run_single_user multiple times, as shown in `debugging_advanced.py `_. diff --git a/docs/running-in-docker.rst b/docs/running-in-docker.rst index 4a0daac115..5e688ed85d 100644 --- a/docs/running-in-docker.rst +++ b/docs/running-in-docker.rst @@ -37,8 +37,8 @@ official Locust docker image as a base image:: Running a distributed load test on Kubernetes ============================================= -The easiest way to run Locust on Kubernetes is to use a `Helm chart `_ +The easiest way to run Locust on Kubernetes is to use a `Helm chart `_. -There is a good helm chart here: `github.com/deliveryhero/helm-charts `_ +There is a good helm chart here: `github.com/deliveryhero/helm-charts `_. Note: this Helm chart is a separate project, and not supported by Locust maintainers. diff --git a/docs/running-without-web-ui.rst b/docs/running-without-web-ui.rst index a4c9ac03b1..aebbba203e 100644 --- a/docs/running-without-web-ui.rst +++ b/docs/running-without-web-ui.rst @@ -83,4 +83,4 @@ Below is an example that'll set the exit code to non zero if any of the followin else: environment.process_exit_code = 0 -(this code could go into the locustfile.py or in any other file that is imported in the locustfile) +Note that this code could go into the locustfile.py or in any other file that is imported in the locustfile. diff --git a/docs/testing-other-systems.rst b/docs/testing-other-systems.rst index 324f413f2d..20fe3e50c3 100644 --- a/docs/testing-other-systems.rst +++ b/docs/testing-other-systems.rst @@ -10,18 +10,18 @@ Locust only comes with built-in support for HTTP/HTTPS but it can be extended to It is important that the protocol libraries you use can be `monkey-patched `_ by gevent. - Almost any libraries that are pure Python (using the Python ``socket`` module or some other standard library function like ``subprocess``) should work fine out of the box - but if they do their I/O calls in C gevent will be unable to patch it. This will block the whole Locust/Python process (in practice limiting you to running a single User per worker process) + Almost any libraries that are pure Python (using the Python ``socket`` module or some other standard library function like ``subprocess``) should work fine out of the box - but if they do their I/O calls in C, gevent will be unable to patch it. This will block the whole Locust/Python process (in practice limiting you to running a single User per worker process). - Some C libraries allow for other workarounds. For example, if you want to use psycopg2 to performance test PostgreSQL, you can use `psycogreen `_. If you are willing to get your hands dirty, you may also be able to do patch a library yourself, but that is beyond the scope of this documentation. + Some C libraries allow for other workarounds. For example, if you want to use psycopg2 to performance test PostgreSQL, you can use `psycogreen `_. If you are willing to get your hands dirty, you may also be able to patch a library yourself, but that is beyond the scope of this documentation. Example: writing an XML-RPC User/client ======================================= -Lets assume we had an XML-RPC server that we wanted to load test +Lets assume we had an XML-RPC server that we wanted to load test. .. literalinclude:: ../examples/custom_xmlrpc_client/server.py -We can build a generic XML-RPC client, by wrapping :py:class:`xmlrpc.client.ServerProxy` +We can build a generic XML-RPC client, by wrapping :py:class:`xmlrpc.client.ServerProxy`. .. literalinclude:: ../examples/custom_xmlrpc_client/xmlrpc_locustfile.py @@ -47,4 +47,4 @@ gRPC client, base User and example usage: .. literalinclude:: ../examples/grpc/locustfile.py -For more examples of user types, see `locust-plugins `_ (it has users for WebSocket/SocketIO, Kafka, Selenium/WebDriver and more) \ No newline at end of file +For more examples of user types, see `locust-plugins `_ (it has users for WebSocket/SocketIO, Kafka, Selenium/WebDriver and more). \ No newline at end of file diff --git a/docs/testing-requests-based SDK's.rst b/docs/testing-requests-based SDK's.rst index c5dd5e5bcf..b52ac579f4 100644 --- a/docs/testing-requests-based SDK's.rst +++ b/docs/testing-requests-based SDK's.rst @@ -4,10 +4,10 @@ Testing Requests based SDKs ============================= -If a prebuilt SDK is available for your target system. Locust has a supported pattern for integrating +If a prebuilt SDK is available for your target system, Locust has a supported pattern for integrating its usage into your load testing efforts. -The only perquisite to achieve this; is that the SDK needs to have an accessible ``request.Sessions`` +The only prerequisite to achieve this is that the SDK needs to have an accessible ``request.Sessions`` class. The following example shows the locust client overwriting the internal ``_session`` object of ``Archivist`` SDK diff --git a/docs/writing-a-locustfile.rst b/docs/writing-a-locustfile.rst index 0eac888989..30a93c621d 100644 --- a/docs/writing-a-locustfile.rst +++ b/docs/writing-a-locustfile.rst @@ -153,7 +153,7 @@ For example, to make each user wait between 0.5 and 10 seconds between every tas * :py:attr:`constant_throughput ` for an adaptive time that ensures the task runs (at most) X times per second. -* :py:attr:`constant_pacing ` for an adaptive time that ensures the task runs (at most) once every X seconds (it is the mathematical inverse of `constant_throughput`) +* :py:attr:`constant_pacing ` for an adaptive time that ensures the task runs (at most) once every X seconds (it is the mathematical inverse of `constant_throughput`). .. note:: @@ -161,9 +161,9 @@ For example, to make each user wait between 0.5 and 10 seconds between every tas Wait time can only constrain the throughput, not launch new Users to reach the target. So, in our example, the throughput will be less than 500 if the time for the task iteration exceeds 10 seconds. - Wait time is applied *after* task execution, so if you have a high spawn rate/ramp up you may end up exceeding your target during rampup. + Wait time is applied *after* task execution, so if you have a high spawn rate/ramp up you may end up exceeding your target during ramp-up. - Wait times apply to *tasks*, not requests. If you, for example, specify `wait_time = constant_throughput(2)` and do two requests in your tasks your request rate/RPS will be 4 per User. + Wait times apply to *tasks*, not requests. For example, if you specify `wait_time = constant_throughput(2)` and do two requests in your tasks, your request rate/RPS will be 4 per User. It's also possible to declare your own wait_time method directly on your class. For example, the following User class would sleep for one second, then two, then three, etc. @@ -206,8 +206,8 @@ classes. Say for example, web users are three times more likely than mobile user Also you can set the :py:attr:`fixed_count ` attribute. In this case the weight property will be ignored and the exact count users will be spawned. -These users are spawned first. In the below example the only instance of AdminUser -will be spawned to make some specific work with more accurate control +These users are spawned first. In the example below, only one instance of AdminUser +will be spawned, to make some specific work with more accurate control of request count independently of total user count. .. code-block:: python @@ -293,7 +293,7 @@ The easiest way to add a task for a User is by using the :py:meth:`task ` decorator, you can be picky about what tasks are -executed during the test using the :code:`--tags` and :code:`--exclude-tags` arguments. Consider +executed during the test using the :code:`--tags` and :code:`--exclude-tags` arguments. Consider the following example: .. code-block:: python @@ -552,7 +552,7 @@ Here's an example of how to call a REST API and validate the response: except KeyError: response.failure("Response did not contain expected key 'greeting'") -locust-plugins has a ready-made class for testing REST API:s called `RestUser `_ +locust-plugins has a ready-made class for testing REST API:s called `RestUser `_. .. _name-parameter: @@ -573,7 +573,7 @@ Example: self.client.get("/blog?id=%i" % i, name="/blog?id=[id]") There may be situations where passing in a parameter into request function is not possible, such as when interacting with libraries/SDK's that -wrap a Requests session. An alternative say of grouping requests is provided By setting the ``client.request_name`` attribute +wrap a Requests session. An alternative way of grouping requests is provided by setting the ``client.request_name`` attribute. .. code-block:: python @@ -583,7 +583,7 @@ wrap a Requests session. An alternative say of grouping requests is provided By self.client.get("/blog?id=%i" % i) self.client.request_name=None -If You want to chain multiple groupings with minimal boilerplate, you can use the ``client.rename_request()`` context manager. +If you want to chain multiple groupings with minimal boilerplate, you can use the ``client.rename_request()`` context manager. .. code-block:: python @@ -613,7 +613,7 @@ Connection pooling ------------------ As every :py:class:`HttpUser ` creates new :py:class:`HttpSession `, -every user instance has it's own connection pools. This is similar to how real users would interact with a web server. +every user instance has its own connection pools. This is similar to how real users would interact with a web server. However, if you want to share connections among all users, you can use a single pool manager. To do this, set :py:attr:`pool_manager ` class attribute to an instance of :py:class:`urllib3.PoolManager`. @@ -633,7 +633,7 @@ For more configuration options, refer to the TaskSets ================================ -TaskSets is a way to structure tests of hierarchical web sites/systems. You can :ref:`read more about it here ` +TaskSets is a way to structure tests of hierarchical web sites/systems. You can :ref:`read more about it here `. How to structure your test code @@ -661,7 +661,7 @@ follow Python best practices. Here's an example file structure of an imaginary L * ``locustfile.py`` * ``requirements.txt`` (External Python dependencies is often kept in a requirements.txt) -A project with multiple different locustfiles could also keep them in a separate subdirectory: +A project with multiple locustfiles could also keep them in a separate subdirectory: * Project root