RE: [load balancing] Big-IP persistence cookie hash behavior

From: Barrett, John (John.BarrettIZZATFMR.COM)
Date: Mon Mar 10 2003 - 08:41:02 EST


We decided not to use the site cookies, instead we use cookie based rules.
It gives us finer control over what we are doing (and we don't have to play
with persistence which doesn't always seem to be stable).

We have each server (and some subset servers) in it's own pool. So we have
pool1 has server 1, pool2 server 2, poolall serves 1,2,3,4...8. We have the
server set the cookies as to which "slice" you come to. Then we wrote a rule
and applied it to the VIP (do NOT use RegEx if you can help it, it slows
down the processing).

The rule goes something like this:
if ((exists http_cookie "slice") and http_cookie "slice" starts_with "web1")
{
   use ( pool1 )
} else if ((exists http_cookie "slice") and http_cookie "slice" starts_with
"web2") {
   use ( pool2 )
}
else {
   use ( poolall )
}

We add a slice, we add a pool and add to the rule. More stable and less
confusing than persistent cookies. Most of our sites are not slice
dependant, however.

-----Original Message-----
From: Jean-Pierre Deckers [mailto:j.deckersIZZATzylom.com]
Sent: Sunday, March 09, 2003 3:01 AM
To: lb-lIZZATvegan.net
Subject: [load balancing] Big-IP persistence cookie hash behavior

Hi all,

I have a question relating to a BigIP, version 4.2 ptf 6.
I've tried to include as much as information as possible, so rather lengthy.

We have a pool of 5 session-based webservers, and we want to
use hash persistence, based on the session-id.
We can only control the first character of the sessionid (a..z,A..Z),
the next 2 characters are always 'aa', so 'aaa', 'baa', 'caa' etc.
On the end of this mail is an overview of the id's set for the servers.

According to F5's SOL777, the first character is accessed by offset 1 (?!),
length 1. Though we did wonder, we tried this and everything mapped to
the same server, i.e. probably using the second character(s).
So we used offset 0, length 1.

Calculation of nodeid with 1 character is done by nodeid = [ord(char) mod
<nr of nodes>]
so a 'd' would become 100 mod 5 = 0, 'h': 104 mod 5 = 4.
Calculation of a nodeid with two characters is nodeid [(((ord(char1)*7)+ord(char2))*7) mod <n.o.n>]

However, a session gets mapped to a server we would not expect.
using offset 0, length 1, a d (100 mod 5 = 0) gets mapped to node 4, e (101
mod 5 = 1) to node 3?!

We can only explain this in two ways:
        * The mapping is inversed: nodeid = [<nr of nodes> - 1 - (ord(char)
mod <nr of nodes>)]
                so nodeid (d) = 5 - 1 - 0 = 4, nodeid (e) = 5 -1 - 1 = 3
etc.
                This is valid, however, not what the SOL states.
        * offset 0, length 1 is instead an offset 0, length 2, as this sum
works too:
                nodeid (da) = ((100*7)+97)*7 mod 5 = 4, nodeid(ea) =...=3
etc.
                This seems to be also a valid option , because of the offset
1 that should be
                used, according to the SOL (unexpected behavior, however,
valid).

We need to be sure which is the correct way, we've searched F5's FAQ's,
the internet etc., but couldn't find any other information about it.

Please, any information is welcome, as we are quite lost inhere.
Adding additional servers has now become trial and error.

---
start of the cookies:
web0:	daa<.*>
web1: eaa<.*>
web2: faa<.*>
web3: gaa<.*>
web4: haa<.*>

Best, Jean-Pierre

____________________ The Load Balancing Mailing List Unsubscribe: mailto:majordomoIZZATvegan.net?body=unsubscribe%20lb-l Archive: http://vegan.net/lb/archive LBDigest: http://lbdigest.com MRTG with SLB: http://vegan.net/MRTG Hosted by: http://www.tokkisystems.com ____________________ The Load Balancing Mailing List Unsubscribe: mailto:majordomoIZZATvegan.net?body=unsubscribe%20lb-l Archive: http://vegan.net/lb/archive LBDigest: http://lbdigest.com MRTG with SLB: http://vegan.net/MRTG Hosted by: http://www.tokkisystems.com



This archive was generated by hypermail 2.1.4 : Fri Mar 21 2003 - 09:53:42 EST