Forum Discussion
Load balancing of tcp data stream
An mblb profile can be used for cases beyond SIP, RADIUS, etc, and would be useful for your case. The generic profile can only be added from the cmdline: tmsh modify ltm virtual your-vserver profiles add { mblb { } }
You can start by just using the CLIENT_ACCEPTED and CLIENT_DATA events. In CLIENT_ACCEPTED, you merely turn on TCP::collect. CLIENT_DATA is called each time a packet is received from the client. TCP::payload will contain all data received from the client that have not been released to a server. Within CLIENT_DATA, you must determine how big the first message is, release that message to a server (TCP::release ), then call TCP::notify eom to tell the LTM this was a complete message. TCP::payload now contains the rest of your messages (minus the first one you just released). As you continue to carve off and release messages from TCP::payload, the LTM will automatically be free to disperse these messages across the currently selected server pool because you have applied the mblb profile.
when CLIENT_ACCEPTED {
log local0. 'conn recvd from [IP::client_addr]'
TCP::collect
}
when CLIENT_DATA {
log local0. 'got client data: [TCP::payload]'
while { [regexp -indices '(.*?)'; [TCP::payload] transaction] } {
log local0. 'A complete transaction was found between [lindex $transaction 0] and [lindex $transaction 1]'
TCP::release [expr [lindex $transaction 1] + 1]
TCP::notify eom
log local0. 'Released a message to be routed by the LTM'
}
log local0. 'We ran out of client data or else the remaining data doesn't constitute a complete message. calling tcp collect'
TCP::collect
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com