For more details, please see ourCookie Policy.

Application Delivery (ADX)

URL Hashing: Enable persistence based on unique strings in the URL

by on ‎05-09-2009 08:42 AM (338 Views)


Some of our incoming HTTP requests have a string “UniqueID”, followed by a  unique string. We want to load balance the requests such that all requests with  the same Unique ID goes to the same server. i.e persist based on URL segment


GET /index.html?UniqueID=12345678 HTTP/1.0


Any request which does not have this value in its URL request should be load  balanced to a default group of servers.




We will use csw persist and hash-to-bucket mechanism to achieve this objective.First we will search the URL for the particular string, in this case UniqueID,  and then, will hash the value following the string and send it to a server. Same values following the string will always result in same hash value and  will be sent to the same server.



Sample Code/Configuration


csw-rule r1 url search "UniqueID="
csw-policy p1
match r1 persist offset 0 length 8 hash-to-bucket
default forward 1
server real RS1
port 8080
port 8080 group-id 1 1
server real RS2
port 8080
port 8080 group-id 1 1
server virtual VIP1
predictor round-robin
port http
port http csw-policy p1
port http csw
bind http RS1 8080 RS2 808