Skip to content

Latest commit

 

History

History
13 lines (12 loc) · 728 Bytes

ratio_based_load_balancing.md

File metadata and controls

13 lines (12 loc) · 728 Bytes

Ratio based Load Balancing

Using pseudo random number generation, in run time take decisions like sending part of the traffic to one pool versus another. Below example sends 2% of connections to a separate pool and remaining 98% of connections are sent to the virtual server's default pool. This is only datascript example, the functionality below can be done through Pool Groups: https://avinetworks.com/docs/latest/pool-groups/ Pools has to be attached to datascript. Apply this to the "HTTP REQUEST" Event.

math.randomseed(os.clock()^5)
-- Send 2% of connections to secondary_pool, the rest to default_pool
if math.random() < 0.02 then avi.pool.select("secondary_pool")
else avi.pool.select("Default_Pool")
end