Forum Discussion
STREAM::expression and "thread safety"
Hi,
I don't think "thread safety" is the right term here, but kinda helps explain my question.
STREAM::expression can be changed in an iRule, and the documentation says it affects "this connection only":
https://devcentral.f5.com/wiki/irules.stream__expression.ashx
What happens if I'm changing this in HTTP_RESPONSE and there's multiple requests / responses on the same TCP connection? Will the STREAM::expression set in one HTTP_RESPONSE pollute the value set in another? Do multiple HTTP_REQUESTs and HTTP_RESPONSEs happen at the same time if there's many concurrent requests from the same browser?
Likewise, for STREAM::enable. I've already come across the issue where enabling STREAM::enable in one HTTP_RESPONSE causes other HTTP requests to also get processed. I think this is because the stream processing is enabled for a connection.
I now use the pattern:
when HTTP_REQUEST {
STREAM::disable
}
when HTTP_RESPONSE {
if {some condition holds} {
STREAM::enable
}
}
This means that the STREAM processing is disabled at the beginning of every request.
However, does this lead to a race condition if there are multiple requests executing in parallel? If response enables the stream, is it visible to other responses on the same connection?
i.e.
REQUEST 1 REQUEST 2
HTTP_REQUEST
(disable stream)
HTTP_REQUEST
(disable stream)
HTTP_RESPONSE
condition is true:
(enable stream)
(stream processing occurs)
HTTP_RESPONSE
condition is false:
(leave stream as-is)
(stream processing occurs anyway)
- Simon_BlakelyEmployee
For the HTTP profile, HTTP pipelining is enabled by default, but current browsers do not enable pipelining by default.
If pipelining is enabled on the HTTP profile, as per
Support for pipelining
By enabling support for pipelining on the BIG-IP® system, you remove the need to enable pipelining on the destination server itself. By default, this feature is enabled.
So you will always get a sequential HTTP_REQUEST/HTTP_RESPONSE for an HTTP profile, and there should be no concerns about event ordering.
I'll provide a separate answer for the HTTP/2 profile when I get some more information.
- Simon_BlakelyEmployee
HTTP/2 allows multiplexed requests.
The individual HTTP/2 requests in the TCP connection will be separated into Streams (based on Stream ID) at the HTTP_REQUEST and responses combined back into the connection at HTTP_RESPONSE.
So from HTTP_REQUEST to HTTP_RESPONSE, STREAM:: is limited in scope to the Stream, and will not interfere with other request/responses.
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