alcounit / selenosis

Scalable, stateless selenium hub for Kubernetes cluster
Apache License 2.0
81 stars 24 forks source link

Browser limit is confusing #39

Closed brendon-r closed 3 years ago

brendon-r commented 3 years ago

This isn't so much a bug but possibly an expansion of the "Scalability" section of the documentation.

The broser-limit parameter to the selenosis container suggests that each replica of the selenosis pod has a limit of 10 browsers and that if I ran 50 replicas of Selenosis, I should be able to run 500 tests. In practice, the browser-limit argument is being picked up by the selenoid-UI and only 10 sessions ever run at the same time.

If a user wanted to scale selenosis to allow for 500 tests to execute in parallel, would they need to scale the deployment to 500 as well as alter the browser-limit? If so, are the sessions being (relatively) evenly distributed across all replicas?

alcounit commented 3 years ago

Hi @beerai browser-limit and selenosis scalability are two different things. Once you set browser-limit selenosis will create a ResourceQuota with that limit and will reject new session requests(create browser pod) when the current limit is reached. Scalability is for other purposes if you are planning a high load like in your example with 500 active sessions, then you probably need to scale selenosis to avoid performance issues.

brendon-r commented 3 years ago

Thanks for the reply, @alcounit. So to confirm my understanding - the browser limit will limit how many sessions requests will result in a browser container being created while the number of selenosis replicas is more for stability.

If that's correct, is it possible to set the browser limit such that there is no limit? I'd like to create a horizontal pod autoscaler to automatically scale selenosis based on load.

alcounit commented 3 years ago

@beerai yes, corrent. Currently selenosis works only with browser-limit this was done to prevent situations with cluster overload and for compatibility with selenoid-ui. You can set any limit you want for example 100000 and play with pod autoscaler :)

alcounit commented 3 years ago

@beerai I assume we can close this issue?

brendon-r commented 3 years ago

@alcounit sorry, yes, we can.

Some fun info though; I've been playing with the autoscaler and for anyone else looking to do the same thing, set the target CPU utilization to about 5%. Anything more than that when running 40 tests in parallel seems to cause timeouts. Still playing around with it but if the target CPU utilization is set to something higher, such as 50%, your selenosis deployment will never scale but will be overloaded.

alcounit commented 3 years ago

@beerai if you find something interesting that you would like to share, feel free to contribute.

brendon-r commented 3 years ago

@alcounit, thanks, once I'm happy with my setup I might shoot a PR to the selenosis-deploy repo with the HPA or something.