Forum Discussion

jgranieri_42214's avatar
jgranieri_42214
Icon for Nimbostratus rankNimbostratus
Jul 01, 2014

Load Balancing based off TCP Payload entity

Hello,

I believe I constructed an irule to properly a variable from text captured from two distinct points in the TCP Payload but I am not 100% certain the Irule will is persisting off this entity. can someone take a look below and see if this looks correct? I added the message load balancing profile on as well.

The expectations are tat after collecting tcp payload for a new connection search for a string and then persists that string to a certain pool ( contains 2 servers). all subsequent matches for that same string in payload need to go to that pool. I also want the pool to load balance diverse entities so not everything is on the same pool member. Does this look correct ?

when CLIENT_ACCEPTED {
  TCP::collect 
}

when CLIENT_DATA {
   set payload [TCP::payload]
   set entityID [findstr $payload "@"  1 ","]
   log local0. "$entityID: $entityID"
   pool XYZ
   persist uie $entityID
   log local4.info " Entity Session routing $entityID and setting persistence"
      TCP::release
      TCP::notify request
}      

33 Replies

  • Hello Kevin & All,

     

    So after some work with the developers they are now sending the entity name in the second TCP socket. However my new dilema is that I need the irule to collect a the entity between particular start/end delimiters in the first socket and in the 2nd socket the start/end delimiters will be completely different.

     

    Here is my current code, its obviously missing that logic... I am thinking along the lines that if the source IP is already connected then set the entityID2 and use findstr as such:

     

    when CLIENTSSL_HANDSHAKE {
       log local0. "[IP::client_addr]:[TCP::client_port]: SSL handshake completed, collecting SSL payload"
       SSL::collect
    }
    when CLIENTSSL_DATA {
       set payload [SSL::payload]
       set entityID [findstr $payload "@" 1 ","]
       set entity [findstr $payload "@" 1 "null"]
       log local0. "Here is the first TCP socket entity $entityID: $entityID"
       log local0. "Here is the second TCP socket entity $entityID2: $entityID2"
       pool xxx_Pool
       persist uie $entityID 1800
       persist uie $entityID2 1800
       log local0. "xxxx Entity Session routing $entityID and setting persistence"
       SSL::release
       }
  • I thought about this some more and I think this logic would work. After collecting unecrypted payload if it contained a string then use the findstr parameters in case1 and LB/persist. If the payload contained another string then use the findstr parameters for case 2 and LB/persist the same... Here is a rough draft but I have syntax errors that need sorting....

    when CLIENTSSL_HANDSHAKE {
       log local0. "[IP::client_addr]:[TCP::client_port]: SSL handshake completed, collecting SSL payload"
       SSL::collect
    }
    when CLIENTSSL_DATA {
       set payload [SSL::payload]
       if { [SSL::payload] contains "UserID" } {
       set entityID [findstr $payload "@" 1 ","]
       log local0. "Here is the zzz TCP socket and the entity is $entityID: $entityID"
       pool xxxx_Pool
       persist uie $entityID 1800 "JEFF" } {
       set entityID2 [findstr $payload "@" 1 "."]
       log local0. "Here is the JEFF TCP socket and the entity is $entityID2: $entityID2"
       pool xxxx_Pool
       persist uie $entityID2 1800
       SSL::release
       }
    }