Forum Discussion

f5guyskenzi's avatar
f5guyskenzi
Icon for Nimbostratus rankNimbostratus
Jul 05, 2024

Packet based load balancing instead of connection based (default)

Hi everyone,

I have a requirement to load balance iso 8583 echo messages across two servers in a pool. I used a performance Layer 4 virtual server to attempt achieving this because I reckon that is the type of virtual server that could fulfill the requirements of load balancing all the requests across the 2 servers in the pool. However, requests are only being sent to one pool member. I also tried to craft an iRule (see below) to do this, still requests are only sent to one pool member.

when CLIENT_ACCEPTED {
 log local0. "ACCEPTED !!"
 TCP::collect

when CLIENT_DATA {
  log local0. "DATA !!"
  #to get the length of messagein hexadecimal,the length info can be get from the first 2 byte
  binary scan [TCP::payload] H4 len 
  log local0. $len
  #convertlentodecimal
  scan $len %x len 
  log local0. $len
  #totalmessage length is length + 2
  set len [expr { $len + 2} ] 
  if {[TCP::payload length] < $len} {
  TCP::collect [expr {$len - [TCP::payload length]}]
  return
}
  TCP::release $len
  TCP::notify request
  TCP::collect
}
when LB_SELECTED {
  log local0. [LB::server]
}
when SERVER_CONNECTED {
    log local0. "Server Connected !!"
    TCP::collect
}
when SERVER_DATA {
    log local0. "response: [TCP::payload]"
    TCP::release
    TCP::notify response
    TCP::collect
}

 

Has anyone done packet-based load balancing before? Any ideas?