universal persistence
4 TopicsUniversal Persistence Profile (UIE) across multiple pools
Hi all I have a question about UIE with multiple pools. I have a Virtual Server which swaps pools depending on the URI: **POOLS:** pool1 server1 server2 pool2 server3 server4 default: server5 server6 **RULE1:** when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]]{ "/uri1/*" { pool pool1 } "/uri2/*" { pool pool2 } default { pool default } } } **RULE2:** when HTTP_REQUEST { if { [HTTP::cookie "JSESSIONID"] ne "" }{ persist uie [HTTP::cookie "JSESSIONID"] } } when HTTP_RESPONSE { if { [HTTP::cookie "JSESSIONID"] ne "" }{ persist add uie [HTTP::cookie "JSESSIONID"] } } /uri1/ has a single sign on system that creates a JSESSIONID cookie. This is used for Universal Persistence. Rule2 is associated with a Universal Persistence Profile. This Profile is then associated with the Virtual Server - this is done so Rule2 can be used on several Virtual Servers and not just the one specified above. User test - in a browser session, request1: http://www.server.com/uri1/getssotoken - this is served by server1 and I get a JSESSIONID cookie request2: http://www.server.com/uri2/somecontent - this is served by server4 request3: http://www.server.com/othercontent - this is served by server6 So the question I have... Any request I now make in this same browser session, depending on uri, I will always be served by either server1, server4 or server6 Is this correct? Thanks169Views0likes0CommentsHow to LoadBalance HTTP 1.1 request
Hi all, Just to set the enviroment first 🙂 We had a customer that wanted to switch from source_addr persistence profile to a persistence based on a specific identifier that cames into http request on a XML field. How customer works its that sends a first http request with a login and the server side answers with a login response with an specific id, an after that sends different operations using that id. Based on that we defined an universal profile that using an irule extracts that information, analyzes the response that comes from login response. (called SessionIdLogin) and also it was needed to define an XML_profile, in order to analyze the following http request in order to obtain the id. (called xml_info) We configured the Virtual Server with * an http profile http * XML profile * Oneconnection Profile --> Oneconnect On the pool configuration we added the xml_info default profile and added the irule SessionIdLogin. Inside this irule, we downgrade the HTTP in order to loadbalance all the request between the nodes. ltm rule /Common/SessionIdLogin { when HTTP_REQUEST { HTTP::header remove "Accept-Encoding" if { [HTTP::version] eq "1.1" } { if { [HTTP::header is_keepalive] } { HTTP::header replace "Connection" "Keep-Alive" } HTTP::version "1.0" } } when HTTP_RESPONSE { if {[HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576}{ set content_length [HTTP::header "Content-Length"] } else { set content_length 1048576 } if { $content_length > 0} { HTTP::collect $content_length } } when HTTP_RESPONSE_DATA { log local0. "Persist in HTTP_RESPONSE_DATA" set SessionId [findstr [HTTP::payload] "sessionId>" 10 "<"] log local0. "$SessionId" if {[HTTP::payload] contains "Login"} { persist add uie $SessionId 160 } } } Till here it was all working fine no problems at all, but the customer noticed that sometimes the http post with login was not working, and we discovered that it was caused because they were sending and specific field from HTTP 1.1, transfer-coding: chunked. As we downgrade to 1.0 the Server didn't understand the petition and provides an error. after all the story, Now the question. 🙂 How could we without downgrade the HTTP version load balance all the requests? Customer is not going to change their code and they still want to do the persistence based on sessionId. One think i though its to add a header inside HTTP_RESPONSE with the connection: close, but i dont know if that its going to work. Thanks in advance people. Victor Jori325Views0likes1Commentuniversal persistence, irules & persist uie command
I am still a bit confused on using universal persistence and the persist command. The big question is :"Can the command persist [add] uie be used in a standard iRule, or does the iRule in which the commands are used, needs to be connected to a universal persistence profile in which the iRule is connected?1.2KViews0likes1CommentURI HASH persistence based on URI depth and string length
Problem this snippet solves: When dealing with caching or AV analysis systems, we may need to define a static persistence method to maximize hits and performances on backend servers. How to use this snippet: Installation You just need to assign the irule to a standard Virtual Server. The VS require at least an http profile and ssl profiles (if doing ssl offloafing or ssl bridging) Variables static::lb_depth - define a subset of the path to use for HASH calculation static::lb_len - define the number of chars to retrieve in the path for HASH calculation static::timeout - define the timeout of the persistence record Features Universal persistence Persistence using URI Hash Specify a depth and/or a string length to get a subset of the URI for the Hash calculation Code : when RULE_INIT { # define the depth of the path that will be used for HASH calculation set static::lb_depth 5 # lb_len variable should be set to 0 if you don't want to use it set static::lb_len 0 set static::timeout 3600 } when HTTP_REQUEST { # initialize required variables set path [string tolower [HTTP::path]] set depth [URI::path [HTTP::uri] depth] # define the depth of the path for hash calculation if { $depth < $static::lb_depth } { set depth_path [HTTP::path] } else { set depth_path [URI::path [HTTP::uri] 1 $static::lb_depth] } set len [string length $depth_path] # define the chars length to be processed for hash calculation if { $static::lb_len > 0 and $static::lb_len < $len } { binary scan [sha1 [string range $depth_path 0 $static::lb_len-1]] w1 key } else { binary scan [sha1 $depth_path] w1 key } persist uie $key $static::timeout } Tested this on version: 11.3369Views0likes0Comments