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

Alternative grouping #1858

Merged
merged 8 commits into from Aug 21, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/index.rst
Expand Up @@ -52,6 +52,7 @@ Other functionalities
custom-load-shape
retrieving-stats
testing-other-systems
testing-requests-based SDK's
increase-performance
extending-locust
logging
Expand All @@ -63,7 +64,7 @@ Further reading / knowledgebase

.. toctree ::
:maxdepth: 1

developing-locust
further-reading

Expand All @@ -74,7 +75,7 @@ API
:maxdepth: 4

api



Changelog
Expand Down
11 changes: 6 additions & 5 deletions docs/testing-other-systems.rst
@@ -1,16 +1,16 @@
.. _testing-other-systems:

========================
Testing non-HTTP systems
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe split this into two sections? ”Testing non-HTTP systems” and ”Testing requests-based SDKs”?

Testing non-HTTP systems
========================

Locust only comes with built-in support for HTTP/HTTPS but it can be extended to load test almost any system. You do this by writing a custom client that triggers :py:attr:`request <locust.event.Events.request>`

.. note::

It is important that any protocol libraries you use can be `monkey-patched <http://www.gevent.org/intro.html#monkey-patching>`_ by gevent (if they use the Python ``socket`` module or some other standard library function like ``subprocess`` you will be fine). Otherwise your calls will block the whole Locust/Python process (in practice limiting you to running a single User per worker process)
Some C libraries cannot be monkey patched by gevent, but allow for other workarounds. For example, if you want to use psycopg2 to performance test PostgreSQL, you can use `psycogreen <https://github.com/psycopg/psycogreen/>`_.

Some C libraries cannot be monkey patched by gevent, but allow for other workarounds. For example, if you want to use psycopg2 to performance test PostgreSQL, you can use `psycogreen <https://github.com/psycopg/psycogreen/>`_.

Example: writing an XML-RPC User/client
=======================================
Expand All @@ -33,7 +33,7 @@ The only significant difference is that you need to make gRPC gevent-compatible,
.. code-block:: python

import grpc.experimental.gevent as grpc_gevent

grpc_gevent.init_gevent()

Dummy server to test:
Expand All @@ -44,4 +44,5 @@ gRPC client, base User and example usage:

.. literalinclude:: ../examples/grpc/locustfile.py

For more examples of user types, see `locust-plugins <https://github.com/SvenskaSpel/locust-plugins#users>`_ (it has users for WebSocket/SocketIO, Kafka, Selenium/WebDriver and more)

For more examples of user types, see `locust-plugins <https://github.com/SvenskaSpel/locust-plugins#users>`_ (it has users for WebSocket/SocketIO, Kafka, Selenium/WebDriver and more)
16 changes: 16 additions & 0 deletions docs/testing-requests-based SDK's.rst
@@ -0,0 +1,16 @@
.. _testing-request-sdks:

=============================
testing-requests-based SDK's
=============================


Example: Patching over SDK's that wrap around Session objects
=============================================================

If you have a prebuilt SDK for a target system that is a essentially a wrapper for Session object.
You can use the a pattern of patching over the internal session object with the locust provided one:

.. literalinclude:: ../examples/sdk_session_patching/session_patch_locustfile.py