Locust: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 7: Line 7:


==Playground==
==Playground==
{|
| valign="top" |
<source lang="bash">
<source lang="bash">
mkdir -p ~/Documents/locust-playground
mkdir -p ~/Documents/locust-playground
cd      ~/Documents/locust-playground
cd      ~/Documents/locust-playground
source ~/.venv/locust/bin/activate
locust --users 100\
--spawn-rate 10 -H http://academia.local
locust --headless --users 100\
--spawn-rate 10 -H http://academia.local
open http://localhost:8089 &>/dev/null &
</source>
</source>
| valign="top" |
<source lang="bash">
cat <<'EOF' > ~/Documents/locust-playground/locustfile.py
from locust import HttpUser, task
class HealthCheck(HttpUser):
    @task
    def hello_world(self):
        self.client.get("/services/audit/health")
        self.client.get("/services/quote/health")
EOF
</source>
|-
| colspan="2" |
----
|-
| valign="top" |
| valign="top" |
|}
==knowledge==
{|
| valign="top" |
gnome-open http://localhost:8080 &>/dev/null &
xdg-open http://localhost:8080 &>/dev/null &
| valign="top" |
sensible-browser http://localhost:8080 &>/dev/null &
x-www-browser http://localhost:8080 &>/dev/null &
| valign="top" |
|-
| colspan="2" |
----
|-
| valign="top" |
| valign="top" |
| valign="top" |
|}


==References==
==References==
Line 17: Line 73:
* [https://docs.locust.io/en/stable/writing-a-locustfile.html Locust » Writing a locustfile]
* [https://docs.locust.io/en/stable/writing-a-locustfile.html Locust » Writing a locustfile]
* [https://docs.locust.io/en/stable/running-in-docker.html Locust » Running in Docker]
* [https://docs.locust.io/en/stable/running-in-docker.html Locust » Running in Docker]
* [https://stackoverflow.com/questions/66771955/ Locust » Multiple Test Files]
* [https://docs.locust.io/en/stable/developing-locust.html Locust » Development]
* [https://github.com/SvenskaSpel/har2locust Locust » <code>har2locust</code>]
* [https://github.com/SvenskaSpel/har2locust Locust » <code>har2locust</code>]
* [https://docs.locust.io/en/stable/configuration.html Locust » Configuration]
* [https://docs.locust.io/en/stable/installation.html Locust » Installation]
* [https://docs.locust.io/en/stable/installation.html Locust » Installation]
* [https://docs.locust.io/en/stable/quickstart.html Locust » Quickstart]
* [https://docs.locust.io/en/stable/quickstart.html Locust » Quickstart]
* [https://github.com/locustio/locust/tree/master/examples Locust » Examples]
* [https://docs.locust.io/en/stable/running-in-docker.html Locust]
* [https://docs.locust.io/en/stable/running-in-docker.html Locust]
| valign="top" |
| valign="top" |
|-
| colspan="3" |
----
|-
| valign="top" |
* [https://github.com/SvenskaSpel/har2locust/blob/main/.headerignore <code>har2locust</code> » <code>.headerignore</code>]
* [https://github.com/SvenskaSpel/har2locust/blob/main/.urlignore <code>har2locust</code> » <code>.urlignore</code>]
* [https://github.com/SvenskaSpel/har2locust/blob/main/har2locust/plugin.py <code>har2locust</code> » <code>plugin.py</code>]


| valign="top" |
| valign="top" |
Line 43: Line 116:


| valign="top" |
| valign="top" |
* [https://k6.io/open-source/ K6 Open Source]


| valign="top" |
| valign="top" |


|}
|}

Latest revision as of 01:28, 2 April 2024

python3 -m venv ~/.venv/locust --prompt="Locust"
source ~/.venv/locust/bin/activate
pip install locust
locust -V

Playground

mkdir -p ~/Documents/locust-playground
cd       ~/Documents/locust-playground
source ~/.venv/locust/bin/activate
locust --users 100\
 --spawn-rate 10 -H http://academia.local

locust --headless --users 100\
 --spawn-rate 10 -H http://academia.local
open http://localhost:8089 &>/dev/null &
cat <<'EOF' > ~/Documents/locust-playground/locustfile.py
from locust import HttpUser, task

class HealthCheck(HttpUser):
    @task
    def hello_world(self):
        self.client.get("/services/audit/health")
        self.client.get("/services/quote/health")
EOF

knowledge

gnome-open http://localhost:8080 &>/dev/null &
xdg-open http://localhost:8080 &>/dev/null &
sensible-browser http://localhost:8080 &>/dev/null &
x-www-browser http://localhost:8080 &>/dev/null &

References