Forum Discussion
xiangyang_zhang
Nimbostratus
Apr 21, 2006Read&Write problem
With the irule below, can read-write problem happen ?
rule tls_flag {
when HTTP_REQUEST {
set tlsflg 0
if {[HTTP::method] equals "CONNECT"}{
set tlsflg 1
}
}
when HTTP_REQUEST_SEND {
if { $tlsreq equals 1 } {
HTTP::disable
}
}
}
Put it with an example
1. The instance 1, a HTTP request, invoke HTTP_REQUEST, so the tlsflg will be set as 0.
2. The instance 2, a HTTPS request, invokes HTTP_REQUEST, then tlsflg is set as 1.
3. Instance 1 going to invoke HTTP_REQUEST_SEND, at this point, what value is tlsflg, 0 or 1 ?
Thanks for any information !
2 Replies
- Variables are shared within the same connection. If you want to use them across sessions, you'll have to reference them in the global namespace.
when HTTP_REQUEST { set local_var "some value" set ::global_var "some other value" log local0. "The local value is $local_var" log local0. "The global value is $::global_var" }
So, the value in the HTTP_REQUeST_SEND event will be that of the associated HTTP_REQUEST event for that connection.
Be careful about using lots of global variables as they remain resident in memory until the configuration is reloaded.
-Joe - xiangyang_zhang
Nimbostratus
Many thanks, Joe ! Your answer is always helpful and precise !
Just now I did the statistics for the hit of if-statement
Under 600TPS and at the interval of 5 minutes, the hit number on
if {[HTTP::method] equals "CONNECT"}{
set tlsflg 1
}
is about 5% higher than on
if { $tlsreq equals 1 } {
HTTP::disable
}
Under lighter load, the numbers of hit are identical.
It seems the local variable cannot keep persistent for one connection when load is higher.
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
