testkube icon indicating copy to clipboard operation
testkube copied to clipboard

Locust executor

Open yarden-slon opened this issue 3 years ago • 9 comments

I need the ability to run distributed Locust with master and multiple workers that communicate with one another. I tried creating it using container executor but faced some issues with the custom job-template. Furthermore, I want it to be one test and with a custom container executor, I will have to create 2 tests - one for the master and one for the worker. Can you please consider adding it as an executor?

yarden-slon avatar Dec 07 '22 10:12 yarden-slon

Thank you, @yarden-slon. Looks like an interesting request. Let @TheBrunoLopes to follow you for details. Sounds like we need to understand better the desired flow

vsukhin avatar Dec 07 '22 10:12 vsukhin

@TheBrunoLopes need to be discussed

vsukhin avatar Dec 13 '22 13:12 vsukhin

Hi. Any update regarding this request? I also need this exactly same feature

teixeira-fernando avatar Nov 18 '24 09:11 teixeira-fernando

HI @teixeira-fernando - thanks for reaching out! This should be doable with the new Workflows engine - have you looked at https://docs.testkube.io/articles/test-workflows-parallel ? If you're not exactly sure how to set it up - could you provide us with a public github repo containing a simple locust test that we can use to try to create an example for you? thanks in advance!

olensmar avatar Nov 18 '24 09:11 olensmar

Hi! In case of Locust, it's actually Services that would support the master/slave communication. We don't have Locust example there, but you can get inspired by JMeter example.

rangoo94 avatar Nov 18 '24 09:11 rangoo94

Actually, Locust looks a bit different than JMeter - the workers are connecting to the master node, so either the master needs to be started before the workers, or at least needs to have a known address before.

Cc: @tkonieczny, as I have idea of "workarounds" to handle it (i.e. headless service), but I'm not sure if that's proper, and additionally it may match a bit our latest discussions about services features.

rangoo94 avatar Nov 18 '24 10:11 rangoo94

Yes, exactly. I was able to create a simple test workflow working on headless mode, but I just have my master node. I still need to find a way to properly have the worker nodes in this same configuration to distribute my load. Here is my example file if you want to have a look:

kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
  name: locust-sample-copy
  namespace: testkube
  labels:
    app.kubernetes.io/name: my-api
    app.kubernetes.io/part-of: my-cms
    testkube.io/test-category: load-test
    testkube.io/test-tool: locust
spec:
  content:
    files:
    - path: locustfile.py
      content: "from locust import HttpUser, task\n\nclass User(HttpUser): \n    @task
        \n    def get_employees(self) -> None:\n        \"\"\"Get a new fact\"\"\"\n
        \       self.client.get(\"/fact\")\n"
  container:
    workingDir: /data
  steps:
  - name: Run locust tests
    run:
      image: locustio/locust
      shell: locust --host https://catfact.ninja --headless --users 100 --spawn-rate
        3 --run-time 60s --html=report.html
status: {}

image

teixeira-fernando avatar Nov 18 '24 10:11 teixeira-fernando

I prepared some examples (including distributed) here: https://github.com/kubeshop/testkube/pull/6053

tkonieczny avatar Nov 25 '24 17:11 tkonieczny

Thanks @tkonieczny . That helps a lot 👍🏻

teixeira-fernando avatar Nov 26 '24 09:11 teixeira-fernando