Forum Discussion

sojourner9_8636's avatar
sojourner9_8636
Icon for Nimbostratus rankNimbostratus
Jul 17, 2008

Persistant balancing based on source IP

I have a pool with 2 servers in it.

 

 

The pool is used mainly for HTTP traffic. But, because of some application oddness - users need to always go to the same server in the pool if it is up. And, they need to be able to return to that original server minutes or even hours later in the day.

 

 

To my mind, what would be easiest would be to do some sort of hash on the source IP address. Or something like "if the last octet is odd" go to server 1 if it is up and server 2 if no.

 

 

 

Anyone have some suggestions on the best way to do this?

3 Replies

  • I think it would be easier if you configured round robin or a load balancing algorithm based on least connections and then specified a persistence profile like source address or cookie insert. This would ensure clients with an valid persistence record would be persisted to the previously selected pool member and new clients would be load balanced to a pool member.

     

     

    Aaron
  • I looked some of the persistence profiles, like "source address" and they default to a 3-minute timeout. Which I take to mean if the user is idle for longer than 3-minutes, the next time they come in, they will get rebalanced.

     

     

    I'm worried about upping that timeout for fear of eating up memory on the F5, forcing it to remember those sockets for hours.

     

     

    Which is why I was hoping a rule or something could do a quick calculation on the IP and always come up with the same answer. That way the F5 would not need to remember the connection.

     

     

     

    But, I hadn't looked at setting the expiration timer on a cookie insert. I'll try that first.

     

     

    In case that fails for some reason and I have to fall back to some sort of source-address parsing - is there a way that can be done ?
  • You can set the timeout to zero to use a session cookie for cookie insert persistence. No memory is used on the BIG-IP to store the persistence info. The client stores the persistence record locally.

     

     

    If you do want to hash the last octect of the client IP, you could use getfield to get the last octect. And you can use the persist command (Click here) to persist based off of the value.

     

     

    Aaron