This section describes the measurement procedures, the SDP structure of the Q4S messages, the different Q4S protocol phases, and the messages exchanged in them.
All elements of the IP network contribute to quality in terms of latency, jitter, bandwidth, and packet loss. All these elements have their own quality policies in terms of priorities, traffic mode, etc., and each element has its own way to manage the quality. The purpose of a quality connection is to establish end-to-end communication with enough quality for the application to function flawlessly.
To monitor quality constraints of the application, four phases are defined and can be seen in
Figure 5:
+---------------------------------------------------------------+
| |
| |
| Handshake ---> Negotiation -+--> Continuity ----> Termination |
| A | (app start) | (app end) |
| | V A V A |
| | violated | violated | |
| | constraints | constraints | |
| | | | |_______| ____| |
| | | | +-------+ | |
| | | | | |
| +------+ +---------------------+ |
| |
+---------------------------------------------------------------+
-
Handshake phase:
-
in which the server is contacted by the client, and in the answer message, the quality constraints for the application are communicated in the embedded SDP.
-
Negotiation phase:
-
in which the quality of the connection is measured in both directions (latency, jitter, bandwidth, and packet loss), and Q4S messages may be sent in order to alert if the measured quality does not meet the constraints. This phase is iterative until quality constraints are reached, or the session is canceled after a number of measurement cycles with consistent violation of the quality constraints. The number of measurement cycles executed depends on the "qos-level", which is incremented in each cycle until a maximum "qos-level" value is reached. Just after reaching the quality requirements, Q4S provides a simple optional mechanism using HTTP to start the application.
-
Continuity phase:
-
in which quality is continuously measured. In this phase, the measurements MUST avoid disturbing the application by consuming network resources. If quality constraints are not met, the server stack will notify the Actuator with an alert notification. If later the quality improves, the server stack will notify the Actuator, in this case with a recovery notification. After several alert notifications with no quality improvements, the Q4S stack SHOULD move to the Termination phase.
-
Termination phase:
-
in which the Q4S session is terminated. The application may be closed also or may not start.
The original goal of SDP was to announce necessary information for the participants and multicast MBONE (Multicast Backbone) applications. Right now, its use has been extended to the announcement and the negotiation of multimedia sessions. The purpose of Q4S is not to establish media stream sessions, but to monitor a quality connection. This connection may be later used to establish any type of session including media sessions; Q4S does not impose any conditions on the type of communication requiring quality parameters.
SDP will be used by Q4S to exchange quality constraints and will therefore always have all the media descriptions ("m=") set to zero.
The SDP embedded in the messages is the container of the quality parameters. As these may vary depending on the direction of the communication (to and from the client), all quality parameters need to specify the uplink and downlink values: <uplink> / <downlink> (see
Section 7.5.3 for an example). When one or both of these values are empty, it
MUST be understood as needing no constraint on that parameter and/or that direction.
The uplink direction
MUST be considered as being the communication from the client to the server. The downlink direction
MUST be considered as being the communication from the server to the client.
The SDP information can comprise all or some of the following parameters shown in the example below. This is an example of an SDP message used by Q4S included in the 200 OK response to a Q4S BEGIN request.
v=0
o=q4s-UA 53655765 2353687637 IN IP4 192.0.2.33
s=Q4S
i=Q4S parameters
t=0 0
a=qos-level:0/0
a=alerting-mode:Reactive
a=alert-pause:5000
a=public-address:client IP4 198.51.100.51
a=public-address:server IP4 198.51.100.58
a=measurement:procedure default(50/50,75/75,5000,40/80,100/256)
a=latency:40
a=jitter:10/10
a=bandwidth:20/6000
a=packetloss:0.50/0.50
a=flow:app clientListeningPort TCP/10000-20000
a=flow:app clientListeningPort UDP/15000-18000
a=flow:app serverListeningPort TCP/56000
a=flow:app serverListeningPort UDP/56000
a=flow:q4s clientListeningPort UDP/55000
a=flow:q4s clientListeningPort TCP/55001
a=flow:q4s serverListeningPort UDP/56000
a=flow:q4s serverListeningPort TCP/56001
As quality constraints may be changed by applications at any time during the Q4S session lifetime, any Q4S 200 OK response sent by the server to the client in the Negotiation and Continuity phases could also include an SDP body with the new quality requirements stated by the applications from then on. Therefore, in response to any PING request sent by the client to the server, the server could send a Q4S 200 OK with an embedded SDP message that specifies new quality constraints requested by the application.
The "qos-level" attribute contains the QoS level for uplink and downlink. Default values are 0 for both directions. The meaning of each level is out of scope of Q4S, but a higher level
SHOULD correspond to a better service quality.
Appropriate attribute values: [0..9] "/" [0..9]
The "qos-level" attribute may be changed during the session lifetime, raising or lowering the value as necessary following the network measurements and the application needs.
The "alerting-mode" attribute specifies the player in charge of triggering Q4S alerts in the case of constraint violation. There are two possible values:
Appropriate attribute values: <"Q4S-aware-network"|"Reactive">
-
Q4S-aware-network:
-
Q4S-ALERT messages are triggered by the server to the client. In this case, the network is supposed to be Q4S aware, and reacts by itself to these alerts.
-
Reactive:
-
alert notifications are sent by the server stack to the Actuator. In this case, the network is not Q4S aware, and a specific node (Actuator) is in charge of triggering tuning mechanisms, either on the network or in the application.
The "alerting-mode" attribute is optional, and if not present, Reactive alerting mode is assumed.
In the Q4S-aware-network scenario, the "alert-pause" attribute specifies the amount of time (in milliseconds) the server waits between consecutive Q4S-ALERT messages sent to the client. In the Reactive scenario, the "alert-pause" attribute specifies the amount of time (in milliseconds) the server stack waits between consecutive alert notifications sent to the Actuator. Measurements are not stopped in Negotiation or Continuity phases during this period of time, but no Q4S-ALERT messages or alert notifications are fired, even with violated quality constraints, allowing for either network reconfigurations or application adjustments.
Appropriate attribute values: [0..60000]
In the Q4S-aware-network scenario, the "recovery-pause" attribute specifies the amount of time (in milliseconds) the server waits for initiating the "qos-level" recovery process. Once the recovery process has started, the "recovery-pause" attribute also states the amount of time (in milliseconds) between consecutive Q4S-RECOVERY messages sent by the server to the client (in the Q4S-aware-network scenario) or between recovery notifications sent by the server stack to the Actuator (in the Reactive scenario).
Appropriate attribute values: [0..60000]
This attribute contains the public IP address of the client and the server. The server fills these attributes with its own public IP address and the public IP address of the first message received from the client in the Handshake phase.
The purpose of these attributes is to make available the addressing information to the network policy server or other external entities in charge of processing Q4S-ALERT messages.
Appropriate attribute values: <"client"|"server"> <"IP4"|"IP6"> <value of IP address>
The maximum latency (considered equal for uplink and downlink) tolerance is specified in the "latency" attribute, expressed in milliseconds. In the Q4S-aware-network scenario, if the latency constraints are not met, a Q4S-ALERT method will be sent to the client. In the Reactive scenario, if the latency constraints are not met, an alert notification will be sent to the Actuator. If the "latency" attribute is not present or has a 0 value, no latency constraints need to be met, and no measurements
MAY be taken.
Appropriate attribute values: [0..9999]
The maximum uplink and downlink jitter tolerance is specified in the "jitter" attribute, expressed in milliseconds. In the Q4S-aware-network scenario, if the jitter constraints are not met, a Q4S-ALERT method will be sent to the client. In the Reactive scenario, if the latency constraints are not met, an alert notification will be sent to the Actuator. If the "jitter" attribute is not present or has a 0 value, no jitter constraints need to be met, and no measurements
MAY be taken.
Appropriate attribute values: [0..9999] "/" [0..9999]
The minimum uplink and downlink bandwidth is specified in the "bandwidth" attribute, expressed in kbps. In the Q4S-aware-network scenario, if the bandwidth constraints are not met, a Q4S-ALERT method will be sent to the client. In the Reactive scenario, an alert notification will be sent to the Actuator. If the "bandwidth" attribute is not present or has a 0 value, no bandwidth constraints need to be met, and no measurements
MAY be taken.
Appropriate attribute values: [0..99999] "/" [0..99999]
The maximum uplink and downlink packet loss tolerance is specified in the "packetloss" attribute expressed in percentage (two decimal accuracy). In the Q4S-aware-network scenario, if the packetloss constraints are not met, a Q4S-ALERT method will be sent to the client. In the Reactive scenario, an alert notification will be sent to the Actuator. If the "packetloss" attribute is not present or has a 0 value, no packet loss constraints need to be met, and no measurements
MAY be taken.
Appropriate attribute values: [0.00 ..100.00] "/"[0.00 ..100.00]
These attributes specify the flows (protocol, destination IP/ports) of data over TCP and UDP ports to be used in uplink and downlink communications.
Several "flow" attributes can be defined. These flows identify the listening port (client or server), the protocol (TCP [
RFC 0793] or UDP [
RFC 0768]) with the range of ports that are going to be used by the application and, of course, by the Q4S protocol (for quality measurements). All defined flows ("app" and "q4s") will be considered within the same quality profile, which is determined by the "qos-level" attribute in each direction. This allows us to assume that measurements on "q4s" flows are the same as experienced by the application, which is using "app" flows.
During Negotiation and Continuity phases, the specified Q4S ports in the "flow:q4s" attributes of SDP will be used for Q4S messages.
The Q4S flows comprise two UDP flows and two TCP flows (one uplink and one downlink for each one), whereas application traffic
MAY consist of many flows, depending on its nature. The Handshake phase takes place through the Q4S Contact URI, using the standard Q4S TCP port. However, the Negotiation and Continuity phases will take place on the Q4S ports (UDP and TCP) specified in the SDP.
The "clientListeningPort" is a port on which the client listens for server requests and
MUST be used as the origin port of client responses. The "serverListeningPort" is a port on which the server is listening for incoming messages from the client. The origin port of server responses may be different than the "serverListeningPort" value.
If "clientListeningPort" is zero ("a=flow:q4s clientListeningPort TCP/0"), the client
MAY choose one randomly per OS standard rules. Client ports inside the SDP must always be matched against actual received port values on the server side in order to deal with NAT/NAPT devices. If a zero value or incorrect value is present, the server must set the value to the received origin port in the next message with SDP (200 OK, ALERT, and CANCEL messages).
Attribute values:
<"q4s"|"app"> <"serverListeningPort"|"clientListeningPort">
<"UDP"|"TCP"> <0..65535> [ "-" [0..65535]]
These attributes contain the measurement procedure and the results of the quality measurements.
Measurement parameters are included using the session attribute "measurement". The first measurement parameter is the procedure. Q4S provides a "default" procedure for measurements, but others like RTP/RTCP might be used and defined later. This document will only define and explain the "default" procedure.
In the initial client request, a set of measurement procedures can be sent to the server for negotiation. One measurement procedure line
MUST be included in the SDP message for each proposed method. The server
MUST answer with only one line with the chosen procedure.
For each procedure, a set of values of parameters separated by "," can be included in the same attribute line. The amount and type of parameters depends on the procedure type.
In the following example, the "default" procedure type is chosen:
a=measurement:procedure default(50/50,75/75,5000,40/80,100/256)
In the "default" procedure, the meaning of these parameters is the following:
-
The first parameter is the interval of time (in milliseconds) between PING requests during the Negotiation phase. Uplink and downlink values from the client's point of view are separated by "/". This allows different responsiveness values depending on the control resources used in each direction.
-
The second parameter is the time interval (in milliseconds) between PING requests during the Continuity phase. Uplink and downlink values are separated by "/". This allows two different responsiveness values depending on the control resources used in each direction.
-
The third parameter is the time interval to be used to measure bandwidth during the Negotiation phase.
-
The fourth parameter indicates the window size for jitter and latency calculations. Uplink and downlink values are separated by "/".
-
The fifth parameter indicates the window size for packet loss calculations. Uplink and downlink values are separated by "/".
There are four more "measurement" attributes:
a=measurement:latency 45
a=measurement:jitter 3/12
a=measurement:bandwidth 200/9800
a=measurement:packetloss 0.00/1.00
The "measurement:latency", "measurement:jitter", "measurement:bandwidth", and "measurement:packetloss" attributes contain the values measured for each of these quality parameters in uplink and downlink directions. Notice that latency is considered equal for uplink and downlink directions. Quality parameter values in these "measurement" attributes provide a snapshot of the quality reached and
MUST only be included in Q4S-ALERT messages in the SDP body such that they can be protected from malicious attacks as these alerts include a signature of the SDP body in the header. The rest of the messages will include the measured values in the Measurements header field.
In the case of the "default" procedure, the valid values are as follows:
a=measurement:procedure default,[0..999]"/" [0..999] "," [0..999]
"/" [0..999] "," [0..9999] "," [0..999]/[0..999] ","
[0..999]/[0..999]
The adaptation of measurement traffic to approximate the actual data streams' characteristics is convenient to accurately estimate the expected QoS for applications. Particularly, packet size can have a remarkable effect on bandwidth estimations. Moreover, this can produce problems depending on the MTU of the end hosts and links along the path.
Therefore, the maximum content length
MAY be set in an attribute denoted as "max-content-length". Its value
MUST be given in bytes and
MUST NOT include application, transport, network, or link layer headers, i.e., size of the content length at the application layer. If not set, the value
MUST be 1000 bytes.
Furthermore, this attribute
MAY be used to communicate MTU limits in endpoints, hence reducing possible bias as a result of network-layer fragmentation.
For instance:
a=max-content-length:1300
This section describes the way quality parameters are measured as defined by the "default" procedure. Measurements
MUST be taken for any quality parameter with constraints, that is, specified in the SDP attributes with non-zero values. For absent attributes, measurements
MAY be omitted.
Latency measurements will be performed if the "latency" attribute and/or the "a=measurement:latency" attribute are present and have non-zero values.
Q4S defines a PING method in order to exchange packets between the client and the server. Based on this PING exchange, the client and the server are able to calculate the round-trip time (RTT). The RTT is the sum of downlink latency (normally named "reverse latency") and uplink latency (normally named "forward latency").
At least 255 samples of RTT
MUST be taken by the client and server. As the forward and reverse latencies are impossible to measure, the client and server will assume that both latencies are identical (symmetric network assumption). The latency will therefore be calculated as the statistical median value of all the RTT samples divided by 2.
Jitter measurements will be performed if the "jitter" attribute and/or the "a=measurement:jitter" attribute are present and have non-zero values.
The jitter can be calculated independently by the client and by the server. The downlink jitter is calculated by the client taking into account the time interval between PING requests as defined by the "measurement:procedure" attribute in the first or second parameter depending on the Q4S protocol phase. The client and the server
MUST send these PING requests at the specified intervals. The client measures the downlink jitter, whereas the server measures the uplink jitter. Note that PING responses are not taken into account when calculating jitter values.
Every time a PING request is received by an endpoint (either server or client), the corresponding jitter value is updated with the statistical jitter value, which is the arithmetic mean of the absolute values of elapsed times calculated on the first 255 packets received.
Each endpoint sends a PING periodically with a fixed interval, and each value of "elapsed time" (ET) should be very close to this interval. If a PING message is lost, the ET value is doubled. Identifying lost PING messages, however, is not an issue because all PING messages are labeled with a Sequence-Number header field. Therefore, the receiver can discard this ET value.
In order to have the first jitter sample, the receiver
MUST wait until it receives 3 PING requests, because each ET is the time between two PINGs, and a jitter measurement needs at least two ET.
The client measures the values of RTT and downlink jitter, and the server measures RTT and uplink jitter, but all measurements are shared with the counterpart by means of the Measurements header field of the PING message.
Bandwidth measurements will be performed if the "bandwidth" attribute and/or the "a=measurement:bandwidth" attribute is present and has non-zero values.
In order to measure the available bandwidth, both the client and the server
MUST start sending BWIDTH messages simultaneously using the UDP control ports exchanged during the Handshake phase in the SDP message at the needed rate to verify the availability of the bandwidth constraint in each direction. The messages are sent during the period of time defined in the third parameter of the SDP "measurement:procedure default" attribute in milliseconds.
a=measurement:procedure default(50/50,75/75,5000,256/256,256/256)
+------------------------------------------------+
| Rate |
| A |
| | |
|downlink rate-|-------------------+ <-- traffic |
| | | sent by |
| | | server |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| uplink rate-|-------------------+ <-- traffic |
| | | sent by |
| | | client |
| | | |
| | | |
| |---|---|---|---|---|----> time |
| 0 1 2 3 4 5 (sec.) |
| |
+------------------------------------------------+
The goal of these measurements is not to identify the available bandwidth of the communication path, but to determine if the required bandwidth is available, meeting the application's constraints. Therefore, the requested bandwidth
MUST be measured sending only the highest bitrate required by the bandwidth attribute. This is illustrated in
Figure 6.
ALERTS are not expected during bandwidth measurement, but only at the end of the measurement time.
When measuring bandwidth, all BWIDTH requests sent
MUST be 1 kilobyte in length (UDP payload length by default), they
MUST include a Sequence-Number header field with a sequential number starting at 0, and their content
MUST consist of randomly generated values to minimize the effect of compression elements along the path. The Sequence-Number
MUST be incremented by 1 with each BWIDTH packet sent. If any measurement stage needs to be repeated, the sequence number
MUST start at zero again. BWIDTH requests
MUST NOT be answered. Examples:
Client message:
=========================
BWIDTH q4s://www.example.com Q4S/1.0
User-Agent: q4s-ua-experimental-1.0
Session-Id: 53655765
Sequence-Number: 0
Content-Type: text
Content-Length: XXXX
Measurements: l=22, j=10, pl=0.00, bw=3000
VkZaU1FrNVZNVlZSV0doT1ZrZ (to complete up to "max-content-
length" bytes UDP payload length)
=========================
The client
MUST send BWIDTH packets to the server to allow the server to measure the uplink bandwidth. The server
MUST send BWIDTH packets to the client to allow the client to measure the downlink bandwidth.
Server message:
=========================
BWIDTH q4s://www.example.com Q4S/1.0
Session-Id: 53655765
Sequence-Number: 0
Content-Type: text
Content-Length: XXXX
Measurements: l=22, j=7, pl=0.00, bw=200
ZY0VaT1ZURlZVVmhyUFE9PQ (to complete up to max-content-
length UDP payload length)
=========================
Packet loss and bandwidth are measured simultaneously using the BWIDTH packets sent by both the client and the server. Because the BWIDTH packets contain a Sequence-Number header field incremented sequentially with each sent packet, lost packets can be easily identified. The lost packets
MUST be counted during the measurement time.
The first phase consists of a Q4S BEGIN method issued from the client to the server as shown in
Figure 7.
The first Q4S message
MUST have a special URI [
RFC 3986], which forces the use of the Q4S protocol if it is implemented in a standard web browser.
This URI, named "Contact URI", is used to request the start of a session. Its scheme
MUST be:
"q4s:" "//" host [":" port] [path["?" query]
Optionally, the client can send the desired quality parameters enclosed in the body of the message as an SDP document. The server
MAY take them into account when building the answer message with the final values in the SDP body, following a request/response schema [
RFC 3264].
If the request is accepted, the server
MUST answer it with a Q4S 200 OK message, which
MUST contain an SDP body [
RFC 4566] with the assigned sess-id (embedded in the SDP "o=" line), the IP addresses to be used, the flow ports to be used, the measurement procedure to be followed, and information about the required quality constraints. Additionally, the "alerting-mode" and "alert-pause" time attributes may be included. Q4S responses should use the protocol designator "Q4S/1.0".
After these two messages are exchanged, the first phase is completed. The quality parameter thresholds have been sent to the client. The next step is to measure the actual quality of the communication path between the client and the server and alert if the Service Level Agreement (SLA) is being violated.
+------------------------------------------------+
| |
| Client Server |
| |
| ------- Q4S BEGIN ------------> |
| |
| <------ Q4S 200 OK ------------ |
| |
| |
+------------------------------------------------+
The following is an example of a client request and a server answer:
Client Request:
=========================
BEGIN q4s://www.example.com Q4S/1.0
Content-Type: application/sdp
User-Agent: q4s-ua-experimental-1.0
Content-Length: 142
(SDP not shown)
=========================
Server Answer:
=========================
Q4S/1.0 200 OK
Date: Mon, 10 Jun 2010 10:00:01 GMT
Content-Type: application/sdp
Expires: 3000
Signature: 6ec1ba40e2adf2d783de530ae254acd4f3477ac4
Content-Length: 131
(SDP not shown)
=========================
The header fields used are explained in
Section 4.3.
The Negotiation phase is in charge of measuring the quality parameters and verifying that the communication paths meet the required quality constraints in both directions as specified in the SDP body.
The measured parameters will be compared with the quality constraints specified in the SDP body. If the quality session is compliant with all the quality constraints, the application can start.
If the quality constraints are not met, a higher quality service level will be demanded. Depending on the scenario, this quality upgrade will be managed as follows:
-
In the Q4S-aware-network scenario:
-
a Q4S-ALERT method will be triggered by the server to the client, and the client will answer with the same Q4S-ALERT method. After receiving the same Q4S-ALERT from the counterpart, no other alerts will be triggered by the server during the "alert-pause" period of time in order to allow the network to react, but measurements will continue to be taken to achieve early detection of improved network quality conditions and a fast application start.
-
In the Reactive scenario:
-
an alert notification will be sent by the server stack to the Actuator, and the Actuator will answer with an alert acknowledgement. After receiving the alert acknowledgement from the Actuator, the server stack will not send other alert notifications during the "alert-pause" period of time in order to allow the Actuator to react and trigger actions on the application or on the policy server, but measurements will continue to be taken to achieve early detection of improved network quality conditions and a fast application start.
In both scenarios stated above, if after several measurement cycles, the network constraints cannot be met, the quality session is terminated. Concretely when, under all possible actions taken by Actuator, the quality remains below requirements, the session must be terminated.
The steps to be taken in this phase depend on the measurement procedure exchanged during the Handshake phase. This document only describes the "default" procedure, but others can be used, like RTP/RTCP [
RFC 3550].
Measurements of latency and jitter are made by calculating the differences in the arrival times of packets and can be achieved with little bandwidth consumption. The bandwidth measurement, on the other hand, involves higher bandwidth consumption in both directions (uplink and downlink).
To avoid wasting unnecessary network resources, these two types of measurements will be performed in two separate stages. If the required latencies and jitters cannot be reached, it makes no sense to waste network resources measuring bandwidth. In addition, if achieving the required latency and jitter thresholds implies upgrading the quality session level, the chance of obtaining compliant bandwidth measurements without retries is higher, saving network traffic again. Therefore, the "default" procedure determines that the measurements are taken in two stages:
-
Stage 0:
-
Measurement of latencies, jitters, and packet loss
-
Stage 1:
-
Measurement of bandwidths and packet loss
Notice that packet loss can be measured in both stages, as all messages exchanged include a Sequence-Number header field that allows for easy packet loss detection.
The client starts the Negotiation phase by sending a READY request using the TCP Q4S ports defined in the SDP. This READY request includes a Stage header field that indicates the measurement stage.
If either jitter, latency, or both are specified, the Negotiation phase begins with the measurement of latencies and jitters (stage 0). If none of those attributes is specified, stage 0 is skipped.
The Stage 0
MUST start with a synchronization message exchange initiated with the client's READY message.
Client Request, READY message:
=========================
READY q4s://www.example.com Q4S/1.0
Stage: 0
Session-Id: 53655765
User-Agent: q4s-ua-experimental-1.0
Content-Length: 0
=========================
Server Response:
=========================
Q4S/1.0 200 OK
Session-Id: 53655765
Stage:0
Content-Length: 0
=========================
This triggers the exchange of a sequence of PING requests and responses that will lead to the calculation of RTT (latency), jitter, and packet loss.
After receiving a 200 OK, the client must send the first PING message, and the server will wait to send PINGs until the reception of this first client PING.
The client and server
MUST send PING requests to each other. The Sequence-Number header field of the first PING
MUST be set to 0. The client and server will manage their own sequence numbers.
+------------------------------------------------+
| |
| Client Server |
| |
| --------- Q4S READY 0 ---------> |
| <-------- Q4S 200 OK ----------- |
| |
| --------- Q4S PING ------------> |
| <-------- Q4S 200 OK ----------- |
| <-------- Q4S PING ------------- |
| -------- Q4S 200 OK ----------> |
| --------- Q4S PING ------------> |
| <-------- Q4S PING ------------- |
| --------- Q4S 200 OK ----------> |
| <-------- Q4S 200 OK ----------- |
| ... |
| |
+------------------------------------------------+
The following is an example of the PING request sent from the client and the server's response:
Client Request:
=========================
PING q4s://www.example.com Q4S/1.0
Session-Id: 53655765
Sequence-Number: 0
User-Agent: q4s-ua-experimental-1.0
Measurements: l=22, j=12, pl=0.20, bw=
Content-Length: 0
=========================
Server Response:
=========================
Q4S/1.0 200 OK
Session-Id: 53655765
Sequence-Number: 0
Content-Length: 0
=========================
The function of the PING method is similar to the ICMP echo request message [
RFC 0792]. The server
MUST answer as soon as it receives the message.
Both endpoints
MUST send Q4S PING messages with the periodicity specified in the first parameter of SDP "measurement:procedure" attribute, always using the same UDP ports and incrementing the Sequence-Number with each message.
In the following example, the value of the first parameter of the SDP "measurement:procedure" attribute is 50 milliseconds (from the client to the server) and 60 ms (from the server to the client):
a=measurement:procedure default(50/60,50/50,5000,256/256,256/256)
They
MUST NOT wait for a response to send the next PING request. The Sequence-Number header field value is incremented sequentially and
MUST start at zero. If this stage is repeated, the initial Sequence-Number
MUST start at zero again.
All PING requests
MUST contain a Measurements header field with the values of the latency, jitter, and packet loss measured by each entity up to that moment. The client will send its measurements to the server, and the server will send its measurements to the client. Example:
Measurements: l=22, j=13, pl=0.10, bw=
Where "l" stands for latency, "j" for jitter, "pl" for packet loss, and "bw" for bandwidth. The bandwidth value is omitted, as it is not measured at this stage.
Optionally the PING request can include a Timestamp header field with the time in which the message has been sent. In the case that the header field is present, the server
MUST include the header field in the response without changing the value.
A minimum number of PING messages
MUST be exchanged in order to be able to measure latency, jitter, and packet loss with certain accuracy (at least 256 samples are
RECOMMENDED to get an accurate packet loss measurement). Both the client and the server calculate the respective measured parameter values. The mechanisms to calculate the different parameters are described in
Section 7.3.
At the end of this stage 0, there are three possibilities:
-
The latency, jitter, and packetloss constraints are reached in both directions
-
The latency, jitter, and packetloss constraints are not reached in one or both directions
In the first case, Stage 0 is finished. The client and server are ready for Stage 1: bandwidth and packet loss measurement. The client moves to stage 1 by sending a READY message that includes the header field, "Stage: 1".
If the bandwidth constraints are either empty or have a value of zero, the Negotiation phase
MUST terminate, and both client and server may initiate the Continuity phase. In this case, client moves to the Continuity phase by sending a READY message that includes the header field, "Stage: 2".
The second case, in which one or more quality constraints have not been met, is detailed in
Section 7.5.4.
This stage begins in a similar way to stage 0, sending a READY request over TCP. The value of the READY message's Stage header field is 1. The server answers with a Q4S 200 OK message to synchronize the initiation of the measurements as shown in
Figure 9.
+------------------------------------------------+
| |
| Client Server |
| |
| --------- Q4S READY 1 -----------> |
| <-------- Q4S 200 OK ------------- |
| |
| --------- Q4S BWIDTH -----------> |
| <-------- Q4S BWIDTH ------------ |
| --------- Q4S BWIDTH -----------> |
| <-------- Q4S BWIDTH ------------ |
| ... |
| |
+------------------------------------------------+
Client Request:
=========================
READY q4s://www.example.com Q4S/1.0
User-Agent: q4s-ua-experimental-1.0
Stage: 1
Session-Id: 53655765
Content-Length: 0
=========================
Server Response:
=========================
Q4S/1.0 200 OK
Session-Id: 53655765
Stage: 1
Content-Length: 0
=========================
Just after receiving the 200 OK, both the client and the server
MUST start sending BWIDTH messages simultaneously using the UDP "q4s" ports.
Section 7.3.3 describes the bandwidth measurement in detail.
At the end of this stage 1, there are three possibilities:
-
The bandwidth and packetloss constraints are reached in both directions.
-
The bandwidth and packetloss constraints are not reached in one or both directions.
In the first case, Stage 1 is finished. The client and server are ready for the Continuity phase. The client moves to this phase by sending a READY message that includes the header field, "Stage: 2". The server answer
MUST be 200 OK as shown in
Figure 10.
+------------------------------------------------+
| |
| Client Server |
| |
| --------- Q4S READY 2 --------------> |
| <---- Q4S 200 OK with trigger URI----- |
| |
| --------- HTTP GET ----------------> |
| |
| (Application starts) |
| |
+------------------------------------------------+
Client Request:
=========================
READY q4s://www.example.com Q4S/1.0
User-Agent: q4s-ua-experimental-1.0
Stage: 2
Session-Id: 53655765
Content-Length: 0
=========================
Server Answer:
=========================
Q4S/1.0 200 OK
Date: Mon, 10 Jun 2010 10:00:01 GMT
Session-Id: 53655765
Trigger-URI: http://www.example.com/app_start
Expires: 3000
Content-Type: application/sdp
Signature: 6ec1ba40e2adf2d783de530ae254acd4f3477ac4
Content-Length: 131
(SDP not shown)
=========================
If the Trigger-URI header field is present, the client
SHOULD send an HTTP request to this URI.
The second case, with violated network constraints, is explained in
Section 7.5.4.
After finishing Stage 1 of the Negotiation phase, the client and the server have each other's measured parameter values as these have been exchanged in the Measurements header fields of the PING and BWIDTH messages. If there is one or more parameters that do not comply with the uplink or downlink application constraints required, both the server and the client are aware of it.
If there is any quality parameter that does not meet the uplink or downlink quality constraints specified in the SDP message, two scenarios are possible depending on the specified alerting mode (if not present, the default value is Reactive alerting mode):
- (a)
-
Q4S-aware-network alerting mode: the server MUST send a Q4S-ALERT message to the client including the digital Signature header field, and the client MUST answer with the same Q4S-ALERT message. The Signature header field contains the signed hash value of the SDP body in order to protect all the SDP data, and therefore it MUST contain the "measurement" parameters in the body.
Server request
=========================
Q4S-ALERT q4s://www.example.com Q4S/1.0
Host: www.example.com
User-Agent: q4s-ua-experimental-1.0
Session-Id: 53655765
Content-Type: application/sdp
Content-Length: 142
v=0
o=q4s-UA 53655765 2353687637 IN IP4 192.0.2.33
s=Q4S
i=Q4S parameters
t=0 0
a=qos-level:1/2
a=alerting-mode: Q4S-aware-network
a=alert-pause:5000
a=public-address:client IP4 198.51.100.51
a=public-address:server IP4 198.51.100.58
a=latency:40
a=jitter:10/10
a=bandwidth:20/6000
a=packetloss:0.50/0.50
a=flow:app downlink TCP/10000-20000
a=flow:app uplink TCP/56000
a=flow:q4s downlink UDP/55000
a=flow:q4s downlink TCP/55001
a=flow:q4s uplink UDP/56000
a=flow:q4s uplink TCP/56001
a=measurement:procedure default(50/50,50/50,5000,256/256,256/256)
a=measurement:latency 30
a=measurement:jitter 6/4
a=measurement:bandwidth 200/4000
a=measurement:packetloss 0.20/0.33
=========================
At this point, both the client and server keep on measuring but without sending new Q4S-ALERT messages during the "alert-pause" milliseconds.
- (b)
- Reactive alerting mode: the server stack MUST send an alert notification to the Actuator, and the Actuator MUST answer with an acknowledgement to the received alert notification. The alert notification sent to the Actuator by the server stack doesn't follow Q4S message style but should have all the information the Actuator will need for the actions to be taken, which will be implementation dependent.
At this point during Negotiation phase, both the client and server keep on measuring without sending new alert notifications to the Actuator during the "alert-pause" milliseconds specified in the SDP. This way, both client and server will detect any improvement in network conditions as soon as the network reacts. The application can start as soon as the number of measurements indicated in the "measurement:procedure" attribute indicates that the quality parameters are met.
The same applies to Continuity phase: the measurement dialog between client and server must not be interrupted by any possible ALERT message.
The actuator receives notifications of unmet requirements from the Q4S server stack and acts upon the application or the network policy server, according to logic out of scope of this protocol.
The Actuator logic activates mechanisms at the application level and/or the network level based on a quality level dictionary, in which the meaning of each level is implementation dependent, and each level involves different actions based on rules to keep a certain user experience quality.
The type of actions that an Actuator can take at the application level are application dependent and
MAY involve:
-
Reduction of application functionalities, such as limitation of application speed or application options.
-
Reduction of application resources usage, such as reduction of frames per second in a video application or any other parameter modification in order to adapt to network conditions.
Apart from actions at the application level, the Actuator
MAY act at the network level if a network policy server is available.
A network policy server may be part of the Reactive scenario, and it is in charge of managing network quality provision. A network policy server may implement all or some of these features (but implementation is not exclusive to):
-
Server validation in terms of quality constraints
-
Authentication (Signature validation) and security (blocking of malicious clients)
-
Policy rules (the following rules are only examples):
-
Maximum quality level allowed for the ACP
-
Time bands allowed for providing quality sessions
-
Number of simultaneous quality sessions allowed
-
Maximum time used by allowed quality sessions
-
Etc.
If any of the policy rules fail, a Q4S-ALERT message
MUST be answered by a 6xx error indicating the cause.
If any constraint was violated, the server
MAY trigger a Q4S-ALERT asking for a higher "qos-level" attribute. The maximum "qos-level" allowed is 9 for both uplink and downlink.
If the "qos-level" has reached the maximum value for the downlink or uplink without matching the constraints, then a CANCEL request
MUST be sent by the client using the TCP port determined in the Handshake phase in order to release the session. In reaction to the reception of the CANCEL request, the server
MUST send a CANCEL request, too. If no CANCEL request is received, the expiration time cancels the session on the server side.
Client Request:
=========================
CANCEL q4s://www.example.com Q4S/1.0
User-Agent: q4s-ua-experimental-1.0
Session-Id: 53655765
Content-Type: application/sdp
Content-Length: 142
(SDP not shown)
=========================
Server Request in reaction to Client Request:
=========================
CANCEL q4s://www.example.com Q4S/1.0
Session-Id: 53655765
Expires: 0
Content-Type: application/sdp
Signature: 6ec1ba40e2adf2d783de530ae254acd4f3477ac4
Content-Length: 131
(SDP not shown)
=========================
During the Negotiation phase, latency, jitter, bandwidth, and packet loss have been measured. During the Continuity phase, bandwidth will not be measured again because bandwidth measurements may disturb application performance.
This phase is supposed to be executed at the same time as the real-time application is being used.
This document only covers the "default" procedure. The continuity operation with the "default" procedure is based on a sliding window of samples. The number of samples involved in the sliding window may be different for jitter and latency than for packet loss calculations according to the fifth and sixth parameters of the "measurement:procedure" attribute. In the example, shown in
Figure 11, the jitter and latency sliding window comprises 40 samples, whereas the size of the packet loss sliding window is 100 samples:
a=measurement:procedure default(50/50,75/75,5000,40/40,100/100)
In addition, the sizes of these windows are configurable per direction: uplink and downlink values may differ.
PING requests are sent continuously (in both directions), and when the Sequence-Number header field reaches the maximum value, the client continues sending PING messages with the Sequence-Number header field starting again at zero. When the server PING Sequence-Number header field reaches the maximum value, it does the same, starting again from zero.
On the client side, the measured values of downlink jitter, downlink packet loss, and latency are calculated using the last samples, discarding older ones, in a sliding window schema.
+--------------------------------------------------+
| |
| 55 56 57 . . . 253 254 255 0 1 2 . . . 55 56 |
| A A |
| | | |
| +-----------------------------------+ |
| |
+--------------------------------------------------+
Only if the server detects that the measured values (downlink or uplink jitter, packet loss, or latency) are not reaching the quality constraints, a Q4S-ALERT is triggered and sent either to the client or to the Actuator, depending on the alerting mode, and the "alert-pause" timer is started.
In the Q4S-aware-network alerting mode shown in
Figure 12, if the client receives a Q4S-ALERT message, it
MUST answer by sending the Q4S-ALERT request message including the SDP (with its corresponding digital signature) back to the server.
Both client and server will keep performing measurements, but Q4S-ALERT messages
MUST NOT be sent during "alert-pause" milliseconds. The operations needed to act on the network and the agents in charge of them are out of scope of this document.
+------------------------------------------------+
| |
| Client Server |
| |
| ... |
| ----------- PING ----------> |
| <--------- 200 OK ---------- |
| <------- Q4S-ALERT --------- |
| -------- Q4S-ALERT --------> |
| <---------- PING ----------- |
| ---------- 200 OK ---------> |
| ----------- PING ----------> |
| <--------- 200 OK ---------- |
| <---------- PING ----------- |
| ---------- 200 OK ---------> |
| ... |
| |
+------------------------------------------------+
In the Reactive scenario shown in
Figure 13, if the server detects that the measured values (downlink or uplink jitter, packet loss, or latency) are not reaching the quality constraints, an alert notification is triggered and sent to the Actuator. The Actuator
MUST then answer to the server stack with an alert acknowledgement.
The measurement dialog between the client and the server
MUST NOT be interrupted by any possible ALERT message.
+------------------------------------------------+
| |
| Client Server Actuator |
| ... |
| --- PING ----------> |
| <-- 200 OK---------- |
| <----- PING -------- |
| <--- 200 OK -------- ---- alert |
| notification --> |
| |
| --- PING ----------> <--- alert |
| acknowledge --- |
| <-- 200 OK---------- |
| <----- PING -------- |
| --- 200 OK --------> |
| ... |
| |
+------------------------------------------------+
The Termination phase is the endpoint for the established Q4S session that is reached in the following cases:
-
A CANCEL message has been received. The client sends a CANCEL message due to the network's inability to meet the required quality constraints. The client and server application will be notified by their respective Q4S stacks.
-
Session expires: if after the Expires time, no client or server activity is detected, that end cancels the session.
-
A BEGIN message has been received by the server. The pre-existing Q4S quality session is canceled, and a new session will be initiated.
The meaning of the Termination phase in terms of the release of resources or accounting is application dependent and out of scope of the Q4S protocol.
In the Reactive alerting mode, Q4S CANCEL messages received by the Q4S server must cause the server stack to send cancel notifications to the Actuator in order to release possible assigned resources for the session.
A session may finish due to several reasons (client shutdown, client CANCEL request, constraints not reached, etc.), and any session finished
MUST release the assigned resources.
In order to release the assigned server resources for the session, the Expires header field indicates the maximum interval of time without exchanging any Q4S message.
Depending on the nature of the application, the quality constraints to be reached may evolve, changing some or all quality constraint values in any direction.
The client
MUST be able to deal with this possibility. When the server sends an SDP document attached to a response (200 OK or Q4S-ALERT, etc.), the client
MUST take all the new received values, overriding any previous value in use.
The dynamic changes on the quality constraints can be a result of two possibilities:
-
The application communicates to the Q4S server a change in the constraints. In this case, the application requirements can evolve, and the Q4S server will be aware of them.
-
The application uses TCP flows. In that case, in order to guarantee a constant throughput, the nature of TCP behavior forces the use of a composite constraint function, which depends on RTT, packet loss, and a window control mechanism implemented in each TCP stack.
TCP throughput can be less than actual bandwidth if the Bandwidth-Delay Product (BDP) is large, or if the network suffers from a high packet loss rate. In both cases, TCP congestion control algorithms may result in a suboptimal performance.
Different TCP congestion control implementations like Reno [
RENO], High Speed TCP [
RFC 3649], CUBIC [
CUBIC], Compound TCP (CTCP) [
CTCP], etc., reach different throughputs under the same network conditions of RTT and packet loss. In all cases, depending on the RTT-measured value, the Q4S server could dynamically change the packetloss constraints (defined in the SDP) in order to make it possible to reach a required throughput or vice versa (using "measurement:packetloss" to change dynamically the latency constraints).
A general guideline for calculating the packet loss constraint and the RTT constraint consists of approximating the throughput by using a simplified formula, which should take into account the TCP stack implementation of the receiver, in addition to the RTT and packet loss:
Th= Function( RTT, packet loss, ...)
Then, depending on RTT-measured values, set dynamically the packet loss constraint.
It is possible to easily calculate a worst-case boundary for the Reno algorithm, which should ensure for all algorithms that the target throughput is actually achieved, except that high-speed algorithms will then have even larger throughput if more bandwidth is available.
For the Reno algorithm, the Mathis formula may be used [
RENO] for the upper bound on the throughput:
Th <= (MSS/RTT)*(1 / sqrt{p})
In the absence of packet loss, a practical limit for the TCP throughput is the receiver_window_size divided by the RTT. However, if the TCP implementation uses a window scale option, this limit can reach the available bandwidth value.
Each time the server detects a violation of constraints, the alert mechanism is triggered, the "alert-pause" timer is started, and the "qos-level" is increased. When this happens repeatedly, and the "qos-level" reaches its maximum value (value 9), the session is canceled. But when the violation of constraints stops before reaching "qos-level" maximum value, the recovery mechanism allows for the "qos-level" upgrade gradually.
This downgrade and upgrade of "qos-level" is explained with the following example:
-
A Q4S session is initiated successfully with "qos-level=0".
-
During the Continuity phase, violation of constraints is detected; the "qos-level" is increased to 1, a Q4S-ALERT is sent by the server to the client, and an "alert-pause" timer is started.
-
The "alert-pause" timer expires, and still a violation of constraints is detected; the "qos-level" is increased to 2, a Q4S-ALERT is sent by the server to the client, and an "alert-pause" timer is started.
-
The "alert-pause" timer expires, but the violation of constraints has stopped; the "recovery-pause" timer is started.
-
The "recovery-pause" timer expires, and no violation of constraints has been detected. Meanwhile, the "qos-level" is decreased to 1, a Q4S-RECOVERY is sent by the server to the client, and the "recovery-pause" timer is started again.
-
The "recovery-pause" timer expires again, and no violation of constraints has been detected. Meanwhile, the "qos-level" is decreased to 0, and a Q4S-RECOVERY is sent by the server to the client. The "recovery-pause" timer is not started this time as the "qos-level" has reached its initial value.
When the network configuration allows for the possibility of managing Q4S flows and application flows independently (either is a network-based QoS or a Q4S-aware network), the "qos-level" downgrade process could be managed more efficiently using a strategy that allows for carrying out "qos-level" downgrades excluding application flows from SDP dynamically. The Q4S flows would be downgraded to allow for measurements on a lower quality level without interference of the application flows. A Q4S client
MUST allow this kind of SDP modification by the server.
Periodically (every several minutes, depending on the implementation) a Q4S-ALERT could be triggered, in which the level is downgraded for Q4S flows, excluding application flows from the embedded SDP of that request.
This mechanism allows the measurement at lower levels of quality while application flows continue using a higher "qos-level" value.
-
If the measurements in the lower level meet the quality constraints, then a Q4S-RECOVERY message to this lower "qos-level" may be triggered, in which the SDP includes the application flows in addition to the Q4S flows.
-
If the measurements in the lower level do not meet the constraints, then a new Q4S-ALERT to the previous "qos-level" MUST be triggered, in which the SDP includes only the Q4S flows.
+------------------------------------------------+
| |
| qos-level |
| A |
| | |
| 4| |
| | |
| 3| +------+ |
| | | | |
| 2| +----+ +----+ +--- |
| | | | | |
| 1| +----+ +-----+ |
| | | |
| 0+---+---------------------------------> time |
| |
+------------------------------------------------+
This mechanism, illustrated in
Figure 14, avoids the risk of disturbing the application while the measurements are being run in lower levels. However, this optional optimization of resources
MUST be used carefully.
The chosen period to measure a lower "qos-level" is implementation dependent. Therefore, it is not included as a "measurement:procedure" parameter. It is
RECOMMENDED to use a large value, such as 20 minutes.