Forum Discussion
sectoroverload2
Nimbostratus
Mar 15, 2010clone web requests for load stress testing
I'm trying to setup two pools in my F5. I have a Production pool with 7 servers and a Test pool with 3 servers. I'm trying to setup an iRule to clone the web requests from Prod > Test but am not havin...
hoolio
Cirrostratus
Jan 09, 2012Here's the current draft for cloning to a single destination. We'll start functional and perf testing shortly. But I'd be happy to hear from anyone else about their experiences with it. I'd suggest using this in a test environment or at least a test virtual server. Just replace http_clone_pool with the name of the pool you want to copy requests to.
when CLIENT_ACCEPTED {
Open a new HSL connection if one is not available
set hsl [HSL::open -proto TCP -pool http_clone_pool]
log local0. "[IP::client_addr]:[TCP::client_port]: New hsl: $hsl"
}
when HTTP_REQUEST {
Insert an XFF header if one is not inserted already
So the client IP can be tracked for the duplicated traffic
HTTP::header insert X-Forwarded-For [IP::client_addr]
Check for POST requests
if {[HTTP::method] eq "POST"}{
Check for Content-Length between 1b and 1Mb
if { [HTTP::header Content-Length] >= 1 && [HTTP::header Content-Length] < 1048576 }{
HTTP::collect [HTTP::header Content-Length]
} elseif {[HTTP::header Content-Length] == 0}{
POST with 0 content-length, so just send the headers
HSL::send $hsl [HTTP::request]
log local0. "[IP::client_addr]:[TCP::client_port]: Sending [HTTP::request]"
}
} else {
Request with no payload, so send just the HTTP headers to the clone pool
HSL::send $hsl [HTTP::request]
log local0. "[IP::client_addr]:[TCP::client_port]: Sending [HTTP::request]"
}
}
when HTTP_REQUEST_DATA {
The parser does not allow HTTP::request in this event, but it works
set request_cmd "HTTP::request"
log local0. "[IP::client_addr]:[TCP::client_port]: Collected [HTTP::payload length] bytes,\
sending [expr {[string length [eval $request_cmd]] + [HTTP::payload length]}] bytes total"
HSL::send $hsl "[eval $request_cmd][HTTP::payload]"
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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