reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
19.09k stars 1.08k forks source link

Add Load Tests Using Locust #3745

Open Alek99 opened 1 month ago

Alek99 commented 1 month ago

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:

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

tsaipraveen99 commented 1 month ago

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

Alek99 commented 1 month ago

Yes will do!

Alek99 commented 1 month ago

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.

tsaipraveen99 commented 1 month ago

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

sksDonni commented 4 weeks ago

Hi @Alek99, can I take this up?

sksDonni commented 3 weeks ago

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.

Alek99 commented 3 weeks ago

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

sksDonni commented 1 week ago

@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.