Forum Discussion
IRule to Re-load Balance
i have 4 Servers at a pool , persistence is source IP 3 servers went down , so all connections went to Server1 , when the 3 servers came back all the old connections didn't go to them & continued on Server1 i know that only new connections will go to them , but the idea is that i want even the new connections to be re-load balanced across all How can i achieve that ? is there an option @ GUI or Irule is needed ?
14 Replies
- SSHSSH_97332
Nimbostratus
Correting : i have 4 Servers at a pool , persistence is source IP 3 servers went down , so all connections went to Server1 , when the 3 servers came back all the old connections didn't go to them & continued on Server1 i know that only new connections will go to them , but the idea is that i want even the old connections to be re-load balanced across all How can i achieve that ? is there an option @ GUI or Irule is needed ?
- What_Lies_Bene1
Cirrostratus
If there was even a way to do this, wouldn't moving a connection from one server to another break the application? I assume there is a reason you do persistence?
- JRahm
Admin
likely an iRule for this..you could track the number of available pool members and anytime there is an increase from the last check, you could remove persistence so they'll reshuffle.
- JRahm
Admin
brain isn't quite moving yet this morning, but this might get you started. basically sets the active pool member count to a variable every 60s, and when a client connects, if its check of the current count is greater than the last count, it'll remove persistence for those clients connecting in the minute where a new pool member was added to the active list. That's the theory anyway.
when RULE_INIT { after 60000 -periodic { set static::counter [active_members /partition/pool] } } when CLIENT_ACCEPTED { if { [active_members /partition/pool] > $static::counter } { persist none } } - SSHSSH_97332
Nimbostratus
Thx all here is my issue: i have users connecting to application server , then application server connects to database server i have around 50 application servers & 5 database servers application servers connects to databsae server using 1 TCP connection ( for ex if 10 users connected to application server 1 , thsi application server1 will have one connection with DB serving all of them ) Now , 3 of DB servers went down , so all connections went to DB Server1 , when the 3 DB servers came back all the old connections didn't go to them & continued on Server1 i know that only new connections will go to them ( but at my case case here there will not be new connections because application server has one TCP connection with DB server serving all users ) , so How can i solve that & force re-load balancing ? The When CLIENT_ACCEPTED Irule will be applied only with 3 way Handshake ( new connections )
- JRahm
Admin
just pick a different appropriate event for your application.
- SSHSSH_97332
Nimbostratus
Thx alot , what i mean is the action "persist none " mentioned @ the above Irule will not make difference because Application server has one TCP connection with DB server ( persistence table may have no affect ) persistence can affect if multiple TCP connections
- What_Lies_Bene1
Cirrostratus
If you don't need persistence turn it off and enable OneConnect and I think all should be well.
- SSHSSH_97332
Nimbostratus
sorry if i'm not able to deliver my question regardless of persistence , here I have one TCP connection from Application server to DB server , persistence will affect new TCP connections only ) ... i have 4 DB Servers at a pool , 3 of DB Servers went Down , so all connections went to DB Server1 , when the 3 servers came back all the old connections didn't go to them & continued on Server1 ... i know that only new connections will go to them , but the idea is that i want even the old connections to be re-load balanced across all How can i achieve that ? is there an option @ GUI or Irule is needed ? ... Clearing Old Connections is a solution , Can i do that with Irule ? What command i need to use to re-load balance or reset all existing connections based on Certain Condition ?
- What_Lies_Bene1
Cirrostratus
OK, so have you tried applying OneConnect?
- Jesse_48456Historic F5 Account
From the initial iRule posted by Jason when RULE_INIT { after 60000 -periodic { set static::counter [active_members /partition/pool] } } is the [active_members /partition/pool] command "valid in RULE_INIT context? I'm getting an error?
- JRahm_128324Historic F5 Accountwhat version are you running? Looks like there might have been a change in 11.4 that prevents this.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com