reflex icon indicating copy to clipboard operation
reflex copied to clipboard

Add Load Tests Using Locust

Open Alek99 opened this issue 1 year ago β€’ 2 comments

We are looking to add load tests to Reflex, to show how many connections we can handle and what this does cpu utilization. Will use this library https://github.com/locustio/locust. This will probably need some plugin like https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/socketio_ex.py to handle websocket interactions since it's all pretty vanilla http out of the box.

Some things we want to test for:

  • idle websocket connections
  • rps events handled (no state modification)
  • rps state modifications with delta (probably router_data)
  • rps (small) substate modifications

These probably need to be with and without redis (but that shouldn't affect how the tests are written)

Alek99 avatar Aug 05 '24 22:08 Alek99

Hi, I would love to work on this issue. Could you please assign it to me?

tsaipraveen99 avatar Aug 06 '24 21:08 tsaipraveen99

Yes will do!

Alek99 avatar Aug 06 '24 23:08 Alek99

Hi, I would love to work on this issue. Could you please assign it to me?

Hi are you still working on this ticket another contributors is interested so please let me know, if not I will un assign and hand it over.

Alek99 avatar Aug 13 '24 22:08 Alek99

Hey Alex, you can assign this issue to other contributors. Thanks!

tsaipraveen99 avatar Aug 14 '24 17:08 tsaipraveen99

Hi @Alek99, can I take this up?

sksDonni avatar Aug 17 '24 14:08 sksDonni

Hi @Alek99 I was looking at how we could go about doing this. I came up with two ways to write these tests.

  1. Write loadtest cases as tasklists with before_start methods in locust which will setup the backend using app harness and then carry out the load tests.
  2. The second option is to spin up an example reflex app and then execute our load tests manually.

The second way is faster and much simpler. So I will prefer going ahead with that approach as of now. Will try the first approach, once we are done with all our test cases. RFC on this.

sksDonni avatar Aug 18 '24 20:08 sksDonni

Sure I'll assign it to you, yes second approach sounds good!

Alek99 avatar Aug 18 '24 21:08 Alek99

@Alek99 I have created load tests for reflex by using the reflex init command to generate a sandbox application. Requesting you for comments on the approach or the code style.

Please note that the PR is still WIP. There are still a few small changes pending to make it compatible with our ruff linter config.

sksDonni avatar Sep 02 '24 21:09 sksDonni