Universal persistence based on UDP payload - what event to use?
Could some body help to shed some light on the below, please?
I have an application that sends loads of short UDP messages which I need to load balance across two servers. Sometimes the messages are big and the senders chunk them (as per the spec here) and in this case all messages from the same sequence must be sent to the same server.
This seemed to be a relatively straightforward scenario for a custom Universal persistence so I created a rule as follows:
when CLIENT_ACCEPTED {
if {[UDP::payload length] >= 12 } {
binary scan [UDP::payload 12] H* chunkedheader
binary scan [UDP::payload 12] H4H16c1c1 magicbytes messageid seqno seqcount
incr seqno
if { $magicbytes equals "1e0f"} {
log local0. "GrayLog chunked message received. Header: $chunkedheader; ID: $messageid (msg $seqno of $seqcount)"
persist uie $messageid
}
}
}
and it seemed to be working fine:
but I do not understand why 🙂
The thing is that the application sends all datagrams from different source ports. Even the datagrams which are part of the same big chunked message are sent from different source ports. As I understand from BigIP perspective this means that every such datagram is a different UDP session in essense. Is this correct? Then logically, as per the UDP event model described here, I should be using CLIENT_DATA event so that the iRule was triggered on every single datagram received from senders. To my surprise, when I do so the persistence table remains empty! How can this be explained? The result must be the same as with CLIENT_ACCEPTED. And, actually, the latter should not work in unlikely cases when subsequent parts of a chunked application message come from the same port number and thus remaining a part of the same session. I have not observed this (same port numbers) in the samples of traffic which I have captured but as I do not know exact specification and logic of the application I am trying to cover all possible scenarios by using CLIENT_DATA. This does not work which confuses me a lot 😞