Forum Discussion
Shu_97237
Jul 12, 2012Nimbostratus
Dispatch messages from a single connection to pool members
Hi, I'm trying to write irules to do message-based load balancing. I am not using SIP/radius/diameter, so cannot use an existing profile. The request messages are all sent over a single TCP...
nitass
Jul 14, 2012Employee
this is my testing. client sends 2 http requests in 1 tcp connection. each request is load balanced to each pool member.
in irule, i determine end of each request by looking for \r\n\r\n.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
mblb {}
tcp {}
}
}
[root@ve10:Active] config b pool foo list
pool foo {
members {
200.200.200.101:80 {}
200.200.200.102:80 {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when CLIENT_ACCEPTED {
log local0. "client: [IP::client_addr]:[TCP::client_port]"
log local0. "virtual: [IP::local_addr]:[TCP::local_port]"
TCP::collect
}
when CLIENT_DATA {
log local0. "request: [TCP::payload]"
if {[TCP::payload] ends_with "\r\n\r\n"} {
TCP::release
TCP::notify request
}
TCP::collect
}
when SERVER_CONNECTED {
log local0. "node: [IP::remote_addr]:[TCP::remote_port]"
TCP::collect
}
when SERVER_DATA {
log local0. "response: [TCP::payload]"
TCP::release
TCP::notify response
TCP::collect
}
when SERVER_CLOSED {
log local0. ""
}
when CLIENT_CLOSED {
log local0. ""
}
}
/var/log/ltm
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : client: 172.28.19.251:37382
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : virtual: 172.28.19.79:80
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : request: GET / HTTP/1.0 User-Agent: ApacheBench/2.0.40-dev Connection: Keep-Alive Host: 172.28.19.79 Accept: */*
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : node: 200.200.200.102:80
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : response: HTTP/1.1 200 OK Date: Sat, 14 Jul 2012 08:35:19 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Tue, 08 Nov 2011 12:26:29 GMT ETag: "4183f1-30-47e02740" Accept-Ranges: bytes Content-Length: 48 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html; charset=UTF-8 This is 102 host.
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : request: GET / HTTP/1.0 User-Agent: ApacheBench/2.0.40-dev Connection: Keep-Alive Host: 172.28.19.79 Accept: */*
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule :
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : node: 200.200.200.101:80
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule : response: HTTP/1.1 200 OK Date: Sat, 14 Jul 2012 08:47:25 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT ETag: "4183e4-3e-9c564780" Accept-Ranges: bytes Content-Length: 62 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html; charset=UTF-8 This is 101 host.
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule :
Jul 14 16:35:00 local/tmm info tmm[5111]: Rule myrule :
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects