Forum Discussion

gkoper_32911's avatar
gkoper_32911
Icon for Nimbostratus rankNimbostratus
Jun 13, 2011

session persistance based on session id parameter

Hello

I want to make load balancing with persistence of session id.

 

Communication is between http gw and JbossWeb nodes.

 

Session-id is stored in the payload of tcp packet.

 

 

 

Do you have any idea how to organize traffic flow that from one session all traffic will be directed to same node? How substract session-id parameter?

 

 

 

I will be happy if someone could help me.

 

thanks

 

Greg

 

7 Replies

  • have u seen this one? is it applicable?

     

     

    sol7392: Overview of universal persistence

     

    http://support.f5.com/kb/en-us/solutions/public/7000/300/sol7392.html

     

     

    hth
  • sorry but its not applicable, there is no cookie within http request. session id is passed within xml code (tcp payload in captured packets)
  • How about using this one as a start:

     http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/33541/showtab/groupforums/Default.aspx1198671
    when CLIENT_ACCEPTED {
    
        set timeout 3600
        set analyse_server 1
        TCP::collect
    }
    
    when CLIENT_DATA {
        log local0. "Client Data______________________________"
        set jsessionid [findstr [TCP::payload] "JSESSIONID=" 11 32]
        log local0. "VALUE jsessionid CLIENT: $jsessionid !"
        if {$jsessionid != ""}{
            log local0. "JSESSIONID is present on the Client , persisting "
            log local0. "connection [IP::remote_addr]:[TCP::remote_port] to [IP::local_addr]:[TCP::local_port]"
            persist uie $jsessionid
            set analyse_server 0
            TCP::release
        } else {
            set analyse_server 1
            log local0. "JSESSIONID is Not present"
            TCP::release
        }
    }
    
    when SERVER_CONNECTED { 
        TCP::collect 
    }
    when SERVER_DATA {
        log local0. "Server Data______________________________"
        set jsessionidsrv [findstr [TCP::payload] "JSESSIONID=" 11 32]
        if ($analyse_server!=0) {
            log local0. "VALUE jsessionid SERVER: $jsessionidsrv !"
            if {$jsessionidsrv != ""}{
                log local0. "JESSIONID detected from server , creating persistence entry "
                log local0. "connection [IP::client_addr]:[TCP::local_port] to[IP::remote_addr]:[TCP::remote_port]"
                persist add uie $jsessionidsrv $timeout
                TCP::release
            } else {
                log local0. "JESSIONID is Not Present : this is NOT NORMAL"
                TCP::release
            }
        } else {
            log local0. "connection [IP::client_addr]:[TCP::local_port] to [IP::remote_addr]:[TCP::remote_port]"
            TCP::release
        }
        log local0. "ENDING SERVER SIDE ANALYSIS"
    }
    when LB_FAILED {
        log local0. "________LB failed_____________"
    }
    
    when PERSIST_DOWN {
        log local0. "________PERSIST DOWN_____________"
    }
    

    Aaron
  • Thx Hoolio

     

     

    It is working. Is it possible to find string ""JSESSIONID": " (with additional quot marks?)

     

    Thank you anyway for support

     

     

    BR

     

    Greg
  • Sure, just escape the double quotes with backslashes:

     

     

    set jsessionid [findstr [TCP::payload] \""JSESSIONID=\"" 13 32]

     

    set jsessionidsrv [findstr [TCP::payload] \""JSESSIONID=\"" 13 32]

     

     

    Aaron
  • Thank you

     

    I have managed to adapt your solution to my case :)

     

     

    Still have some problems.

     

    How we can realize fail-over with such created persistence?

     

    As I know already LB_FAILED is triggered when LTM is ready to send the request to a pool member and one hasn’t been chosen (the system failed to select a pool or a pool member), is unreachable (when no route to the target exists), or is non-responsive (fails to respond to a connection request).

     

    i found only:

     

    when LB_FAILED {

     

    if { [active_members [LB::server pool]] > 0 } {

     

    catch { LB::down }

     

    LB::mode rr

     

    LB::reselect

     

    }

     

    }

     

    But in my case persistence need to be also updated with new server ip.

     

    Do you have some idea how to use LB_FAILED event in correct way?

     

     

    BR

     

    Greg
  • The persistence would be updated if you reselect a new pool member in LB_FAILED and the server sends a JSESSIONID that you parse in SERVER_DATA.

     

     

    Aaron