Selenium Grid load balancing across nodes

62 views
Skip to first unread message

Justin Wagner

unread,
Aug 25, 2022, 12:40:14 AM8/25/22
to Selenium Users
I'm using v4.1.3 of selenium grid and trying to figure out how the load balancing works. Right now I have two nodes, one is an older Windows desktop with capacity for 8 browser sessions and one is a newer Windows desktop with capacity for 12. 

If I start execution of test cases one by one until all 20 slots are in use, the first 8 start up using the node running on the slower Windows desktop, and after that it starts sending them to the faster desktop until it's maxxed out.

I have the hub and a node running on the faster desktop, and a node running on the slower desktop, pointed to the hub on the faster machine.

Is this how it's supposed to distribute test cases? I expected the hub to distribute one test case to the slow machine, then one to the fast machine, then another to the slow machine, etc until all of the slots are used. 

⇜Krishnan Mahadevan⇝

unread,
Aug 25, 2022, 1:33:36 AM8/25/22
to seleniu...@googlegroups.com
Justin,

I believe that the hub just ends up finding the first node that can honour the new session.

First org.openqa.grid.internal.ProxySet#getNewSession gets called.
This internally calls org.openqa.grid.internal.ProxySet#getSorted which sorts the nodes based on their resource utilisation in percent.
In order to compute the resource utilisation, this is the logic that gets used "100 * (float)getTotalUsed() / (float)getMaxNumberOfConcurrentTestSessions();" If two nodes have the same resource utilisation (i.e., same test slots and same currently running tests) then we look at who has the oldest + latest session that was started (basically find a node that was recently used to allocate a new session and pick that when there's a tie)

If you would like to have a different sort of distribution, then you may have to plugin either your own RemoteProxy mechanism gives a different mechanism when it comes to computing the resource utilisation in percentage and wire in that remote proxy.

To learn how to wire in a remote proxy of your own, take a look at my blog : https://rationaleemotions.github.io/gridopadesham/CUSTOM_PROXY.html


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/badddc9a-5ae5-413c-8f31-f0a42f1d8fb1n%40googlegroups.com.

Justin Wagner

unread,
Aug 31, 2022, 1:38:43 PM8/31/22
to Selenium Users
Thanks for the info, I will look into it.
Reply all
Reply to author
Forward
0 new messages