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

Update docs for running locust in Step Load Mode #1235

Merged
merged 2 commits into from
Jan 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/images/webui-splash-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/webui-stepload-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,7 @@ and point it to http://127.0.0.1:8089 (if you are running Locust locally). Then
greeted with something like this:

.. image:: images/webui-splash-screenshot.png

If you :ref:`run Locust in Step Load Mode <running-locust-in-step-load-mode>`, then you should be greeted with Locust UI like this:

.. image:: images/webui-stepload-screenshot.png
6 changes: 6 additions & 0 deletions docs/running-locust-distributed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ Running Locust distributed without the web UI
See :ref:`running-locust-distributed-without-web-ui`


Running Locust distributed in Step Load mode
=============================================

See :ref:`running-locust-in-step-load-mode`


Increase Locust's performance
=============================

Expand Down
52 changes: 52 additions & 0 deletions docs/running-locust-in-step-load-mode.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.. _running-locust-in-step-load-mode:

=================================
Running Locust in Step Load Mode
=================================

If you want to monitor your service performance with different user load and probe the max tps that can be achieved, you can run Locust with Step Load enabled with ``--step-load``:

.. code-block:: console

$ locust -f locust_files/my_locust_file.py --step-load


Options
=======

``--step-load``
------------

Enable Step Load mode to monitor how performance metrics varies when user load increases.


``--step-clients``
-----------

Client count to increase by step in Step Load mode. Only used together with ``--step-load``.


``--step-time``
-------------------------

Step duration in Step Load mode, e.g. (300s, 20m, 3h, 1h30m, etc.). Only used together with ``--step-load``.


Running Locust in step load mode without the web UI
---------------------------------

If you want to run Locust in step load mode without the web UI, you can do that with ``--step-clients`` and ``--step-time``:

.. code-block:: console

$ locust -f --no-web -c 1000 -r 100 --run-time 1h30m --step-load --step-clients 300 --step-time 20m

Locust will swarm the clients by step and shutdown once the time is up.


Running Locust distributed in step load mode
---------------------------------------------

If you want to :ref:`run Locust distributed <running-locust-distributed>` in step load mode,
you should specify the ``--step-load`` option when starting the master node, to swarm locusts by step. It will then show the ``--step-cients`` option and ``--step-time`` option in Locust UI.

4 changes: 2 additions & 2 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ def start_stepload(self, locust_count, hatch_rate, step_locust_count, step_durat

if self.stepload_greenlet:
logger.info("There is an ongoing swarming in Step Load mode, will stop it now.")
self.greenlet.killone(self.stepload_greenlet)
self.stepload_greenlet.kill()
logger.info("Start a new swarming in Step Load mode: total locust count of %d, hatch rate of %d, step locust count of %d, step duration of %d " % (locust_count, hatch_rate, step_locust_count, step_duration))
self.state = STATE_INIT
self.stepload_greenlet = self.greenlet.spawn(self.stepload_worker)
self.stepload_greenlet = gevent.spawn(self.stepload_worker)
self.stepload_greenlet.link_exception(callback=self.noop)

def stepload_worker(self):
Expand Down