\documentstyle{article}
\textwidth 6.5in
\textheight 8.750in
\oddsidemargin -0.1in
\topmargin -0.25in
%\baselineskip=10pt plus 5pt
%\lineskip=10pt
%\lineskiplimit=10pt
\input{psfig}
\makeatletter
% These allow switching interline spacing; the change takes effect immediately:
\newcommand{\singlespacing}{\let\CS=\@currsize\renewcommand{\baselinestretch}{1}\tiny\CS}
\newcommand{\oneandahalfspacing}{\let\CS=\@currsize\renewcommand{\baselinestretch}{1.25}\tiny\CS}
\newcommand{\doublespacing}{\let\CS=\@currsize\renewcommand{\baselinestretch}{1.5}\tiny\CS}
% Start with double spacing:
\oneandahalfspacing
%\doublespacing
\newtheorem{lemma}{Lemma}
\newtheorem{exmp}{Example}%[chapter]
\newtheorem{dfn}{Definition}%[chapter]
%\newtheorem{asm}{Assumption}%[chapter]
\newcommand{\blob}{\hfill \rule{.1in}{0.1in}}
\newcommand{\beqa}{\begin{eqnarray}}
\newcommand{\eeqa}{\end{eqnarray}}
\newcommand{\beqan}{\begin{eqnarray*}}
\newcommand{\eeqan}{\end{eqnarray*}}
\newcommand{\beq}{\begin{equation}}
\newcommand{\eeq}{\end{equation}}
\newcommand{\prf}{\noindent {\bf Proof}\ \ \ }
\newcommand{\lra}{\Longleftrightarrow}
\newcommand{\lbr}{\left \{ }
\newcommand{\rbr}{\right \} }
\newcommand{\Lbr}{\left [}
\newcommand{\Rbr}{\right ]}
\newcommand{\lp}{\left (}
\newcommand{\rp}{\right )}
\newcommand{\df}{\stackrel{\triangle}{=}}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[section]
%\def\baselinestretch{1.5}
\newcommand{\bfl}{\begin{flushleft}}
\newcommand{\efl}{\end{flushleft}}
\newcommand{\bgnv}{\begin{verbatim}}
\newcommand{\ednv}{\end{verbatim}}
\begin{document}
\title{\bf EE 290Q Topics in Communication Networks\\
Lecture~7: End-to-End Delay with Traffic Shaping}
\author{Matthew Siler}
\date{February 6, 1996}
\maketitle
\section{Introduction}
The focus of this lecture is to show how traffic shaping and the
{\em Earliest Due-Date} (EDD) scheduling algorithm can give
the same or better bounds on worst-case
delay than the {\em Generalized Processor Sharing} (GPS) policy
discussed earlier. Although GPS provides a guaranteed service rate to
each session, the worst-case delay is not tight
because of the bursty nature of
the traffic stream. Using a traffic shaper at each node reduces burstiness and
tightens the worst-case delay bound.
In Section~2, we begin by identifying the two systems we will be comparing,
and outline a method for reducing the delay
bound by introducing traffic shaping. The first system will use
GPS scheduling without traffic shaping, whereas the second system
will use traffic shapers and EDD scheduling at each node.
Section~3 states a key
theorem that will be used in showing the advantages of traffic shaping
over GPS. For Section~4, we calculate the end-to-end delay
for a two-node example and show how it is the same as the one
given by GPS.
Section~5 describes an
algorithm for implementing a traffic shaper and EDD priority
scheduler in software. In Section~6, we conclude with some of the key
results presented here.
\section{Comparison of GPS and Traffic Shaping with EDD}
In this paper, we will be comparing two systems. In both systems,
we assume that we are using a leaky bucket rate controller to bound
the arrival rate. The first
system uses a GPS scheduler.
The second system smooths the incoming traffic with a traffic shaper,
and the packets are then released according to the EDD policy.
With the GPS system, we assign a set of weights $\vec{\phi}^m$ at each
node $m$, where $\phi_i^m$ denotes the weight given to session $i$ at node
$m$. Session $i$ uses a leaky
bucker rate controller with parameters $(\sigma_i, \rho_i)$. Further, we
assume that the network is stable and that the internal burstiness is
bounded. Since the sessions are constrained by leaky bucket
controllers, we can construct a greedy regime that allows us
to calculate an end-to-end service curve
$\hat{S}_i(t)$ and the worst-case delay bound $D_i^*$.
This service curve is tight in the sense that we can construct
a sequence of events where
the curve is followed exactly and the worst-case delay is achieved.
A fundamental
problem with GPS is that the traffic actually becomes more bursty as it
travels from node to node, and it is this burstiness that causes the
worst-case delay to be large. We will see that by shaping the traffic before it
enters the system, and by re-shaping the traffic at every node,
we can tighten the delay bound and derive a service
curve that is at least as good as GPS, if not better.
The second system will be built in two steps. First, we will assume that
GPS is used for scheduling, with the same weights
as before. Then, we will introduce traffic shaping to
smooth the arriving traffic stream to a peak
rate $c_i$ for each session $i$. In Section~4.2, we will show how
to find an appropriate value of $c_i$.
Second, we will replace the GPS scheduler
with the EDD scheduler at every node. This will allow us to compute the
end-to-end worst-case delay.
Since EDD scheduling is optimal, {\em the worst-case delay given by
traffic shaping with EDD scheduling will always be better than the
one given by GPS scheduling}.
\section{Traffic Shaping Theorem}
We now introduce a theorem that will help us with analyzing the affect of
using a traffic shaper on a system using GPS.
\begin{theorem}
Let $c_i$ be the peak rate at which traffic leaves the traffic
shaper (or re-shaper) in the session $i$, and let $\vec{c}$ be any vector
that assigns a particular $c_i$ to each session. Given a particular
choice of $\vec{c}$, the end-to-end
worst-case delay after traffic shaping is given by
$\bar{D}_i(\vec{c}) = \sum_{i=1}^{H_i} D_i^{m*}(\vec{c})$
for each session $i$, where $D_i^{m*}$ is the worst-case
delay at node $m$. Then, there exists a $\vec{c}$ such that
\beq
\bar{D_{i}}(\vec{c}) \leq D_i^* \forall{i}.
\label{bound-lmax}
\eeq
\end{theorem}
This implies that we can always find an assignment $\vec{c}$ such that
we will do at least as well as GPS, if not better. We can choose the
$\vec{c}$ so that the worst-case delay bound given by the additive method is
at least as good as GPS. However, one must find an appropriate value
of $c_i$ for every $i$ that achieves this. Note that the particular choice
of $c_i$ stays the same at each node because the traffic has been
properly smoothed at the first node and we continue to re-shape the
traffic at subsequent nodes.
\begin{corollary}
If we replace GPS with the EDD scheduling algorithm, then we
can achieve a better delay bound with appropriate delay budgeting.
\end{corollary}
In the previous lecture, we showed that EDD was optimal, so this corollary
follows from the theorem.
\section{Example}
In this section, we will show the validity of the theorem by demonstrating how
traffic shaping gives us the same worst-case delay bound as GPS.
With an appropriate use of traffic shapers across multiple sessions
in a network, we can do better than GPS.
\subsection{Delay Bounds with GPS}
For the first system,
We start by looking at the service curve under GPS. The end-to-end
service curve for session $i$ is denoted by $\hat{S}_{i}(t)$. Let
$H_i$ be the number of nodes in the path for session $i$. From previous
lectures, we know that this end-to-end delay curve is composed of the nodal
service curves, denoted by $\hat{S}_{i}^{m}(t)$ for session $i$ at node $m$.
In fact,
\beq
\hat{S_{i}}(t) = \min_{\sum{t_m} = t} \sum_{i=1}^{H_i} \hat{S}_{i}^{m}(t_m).
\eeq
\begin{figure}[ht]
\centerline{\psfig{figure=nodecurve.epsi}}
\caption{\em Nodal Service Curves $\hat{S}_i^1(t)$ and $\hat{S}_i^2(t)$.}
\label{f:nodecurve}
\end{figure}
Therefore, we can derive the end-to-end service curve by minimizing over the
nodal service curves of all $H_i$ nodes in the session's path. For example, suppose
we have two nodes, node $1$ and node $2$, for session $i$, where
traffic flows from node $1$ to node $2$.
The service curves at node $1$ and node $2$ are given in Figure
\ref{f:nodecurve}. Recall that $\hat{S}_i^m(t)$ is the service
curve at node $m$ and can be constructed from the leaky bucket
parameters and weights for each session $i$ according to the
greedy regime.
We can build $\hat{S}_i(t)$ by breaking up the service
curve into segments with constant slopes. We start by searching
through all the nodal service curves and finding the
node that has the segment with smallest slope for $\hat{S}_i^m(0+)$.
Let $\hat{m}$ be this node and $(0, t_1)$ denote the interval.
Therefore, $\hat{S}_i(t)$ is identical to $\hat{S}_i^{\hat{m}}(t)$ for
the interval $(0, t_1)$.
We construct the next segment for $\hat{S}_i(t)$ by taking the
segment with smallest slope among $\hat{S}_i^{\hat{m}}(t_1+)$ and
$\hat{S}_i^m(0+)$ for $m \neq \hat{m}$. This segment forms the
next segment for $\hat{S}_i(t)$, and we continue with this
process until time $t$.
\begin{figure}[ht]
\centerline{\psfig{figure=endcurve.epsi}}
\caption{\em End-to-End Service Curve $\hat{S}_i(t)$.}
\label{f:endcurve}
\end{figure}
Figure \ref{f:endcurve} shows the completed end-to-end service curve
$\hat{S}_i(t)$. This demonstrates the worst-case behavior
of the other traffic streams according to GPS.
\subsection{Delay Bounds with Traffic Shaping}
For the second system, we start by assuming that we
are still using GPS scheduling,
except this time we shape the incoming traffic to reduce
the burstiness of the traffic source. EDD scheduling
will be added later to make the scheduler optimal. By using an
appropriate traffic shaper between nodes for session $i$, we can achieve
the same worst-case delay bound as we do with GPS alone. In fact,
if we also smooth the traffic of the other competing sessions at
node $m$, then we can actually
do better than GPS.
The traffic shaper has an envelope $\bar{A}_i^1(\tau) = \mbox{min}
\{c_i\tau,\sigma_i+\rho_i\tau\}$. Here, the choice of
$c_i$ will determine the maximum rate that can leave the
traffic shaper. Therefore, if there is a burst of $\sigma_i$ at
$t = 0$, then it
will take $\sigma_i \over c_i$ amount of time for the traffic
shaper to completely release this burst of traffic.
Without the traffic
shaper, this burst would immediately be forwarded to the first node,
instead of being delayed.
A natural question at this point is how do we choose an appropriate value
of $c_i$? To answer this, we must consider two possible cases.
For both cases, assume a burst of size $\sigma_i$ occurs at time $t = 0$
and that we follow the service curve $\hat{S}_i(t)$ exactly
(worst-case). We also assume that the session $i$ traffic
will be traveling through two nodes, A and B, in that order.
\subsubsection{Case I}
We consider the
case where the slope of the service curve is ${\bf s} \geq \rho_i$
when the burst $\sigma_i$ clears the traffic shaper. This implies that
the queue is largest at this time, giving the
worst-case delay. In this case, the appropriate
value is $c_i = {\bf s}$.
\begin{figure}[ht]
\centerline{\psfig{figure=case1.epsi}}
\caption{\em Case I: End-to-end Delay for Session $i$.}
\label{f:case1}
\end{figure}
Figure \ref{f:case1} shows the arrival rates for both the first
and second systems, as well as the service curve $\hat{S}_i(t)$.
The arrival rate for the first system is governed by the leaky bucket
rate controller with parameters $(\sigma_i, \rho_i)$.
The system system has the arrival curve given by the line with
slope $c_i$. The traffic shaper limits the maximum arrival
rate to the server to $c_i$.
This gives a new arrival
curve that clearly reduces the worst-case delay at the nodes.
However, the traffic shaper imposes a new delay equal to
$\sigma_i \over c_i$ and given by the solid line indicated in the
figure.
The horizontal dotted line indicates the worst-case delay
from GPS. If we draw lines of slope {\bf s} from the
breakpoints of the service curve $\hat{S}_i(t)$,
then we can partition the worst-case delay into
intervals of length $a_i, b, \mbox{and} a_2$ which are the
nodal delays from nodes A, B, and A, respectively. Therefore, the
total delay is given by the delay of the smoother plus
the sum of the nodal delays:
\beq
D_i^* = {{\sigma_i} \over {{\bf s}}} + a_1 + b + a_2
\eeq
We only count
the delay from the first traffic shaper since subsequent
traffic shapers use the same choice of $c_i$ and
will not impose any further delays.
\begin{figure}[ht]
\centerline{\psfig{figure=case1A.epsi}}
\caption{\em Case I: Delay at Node A after Traffic Shaping.}
\label{f:case1A}
\end{figure}
Figure \ref{f:case1A} shows the arrival rates for both systems,
and the service curve $\bar{S}_i^a(t)$, for just
the first node (node A). Again, the arrival rate for the first system
is bounded by the leaky bucket constraint $(\sigma_i,\rho_i)$, and
the arrival rate for the second system is limited to the rate $c_i$.
This graph shows that the worst-case delay for system $2$ is
$\bar{D}_i^a = a_1 + a_2$. The traffic shaper does not affect the service
curve, so $\bar{S}_i^a(t) = \hat{S}_i^a(t)$.
However, the traffic shaper before node A removes
some of the burstiness from the source and gives a
new arrival curve with slope $c_i = {\bf s}$.
The graph for node B can be derived in a similar fashion
to show that $\bar{D}_i^b = b$.
\subsubsection{Case II}
Now, we consider the case where the slope of the service curve
is ${\bf s} < \rho_i$
when the burst $\sigma_i$ clears the traffic shaper. This implies that
the worst-case delay is yet to come. In this case, we set
$c_i = \rho_i$ because anything
less would violate our condition that the system be
stable.
\begin{figure}[ht]
\centerline{\psfig{figure=case2.epsi}}
\caption{\em Case II: End-to-end Delay for Session $i$.}
\label{f:case2}
\end{figure}
Figure \ref{f:case2} shows the arrival rate and service curve in this
case. The worst-case delay is given by the top dashed line.
The delay continues to increase once the burst clears
because most of the competing sessions are still backlogged,
and the queue continues to fill. The worst-case delay is
reached at the point where the slope {\bf s} of the
service curve is greater or equal to $c_i = \rho_i$.
\section{Traffic Shaper and EDD Implementation}
We have now shown that traffic shaping with EDD
can give us better delay
bounds than GPS, but is there a good distributed
algorithm that can achieve
this?
\begin{figure}[ht]
\centerline{\psfig{figure=calqueue.epsi}}
\caption{\em Implementation of the Calendar Queue for Traffic Shaping.}
\label{f:calqueue}
\end{figure}
Figure \ref{f:calqueue} shows an implementation
of a traffic shaper.
We can implement a shaper as a calendar queue, where every entry is a time
slot. The calendar queue is designed as an array with a fixed length,
which is determined by the worst-case delay of the session.
The clock references the current time slot being released in the
calendar queue.
For each time slot, we have a linked list, with one record for each session that
transmits during that time slot. Following
each session record is a linked list of
packets for that session that are scheduled to be released
for that particular time slot. Once the clock references a non-empty
time slot, all the packets referenced in that time slot are released
to the EDD scheduler.
The EDD scheduler is implemented as a priority queue. When a packet
arrives, the due date is calculated from the time it arrived and its
delay constriants. Then it is placed in the priority queue
according to when it should be released in relation to the other sessions.
Packets within a session all have the same priority level, so
the priority
queue only needs to keep track of the first packet for each session.
Packets within a session are organized according to a
{\em First-Come First-Serve} (FCFS) policy.
When the traffic shaper and scheduler are implemented in this fashion,
lookups in the calendar queue take a constant amount of time, O(1),
whereas insertions and deletions are implemented in logarithmic
time, O(log(N)). Note that this scheme is not work-conserving
since no packets will be transmitted if none are scheduled. However,
this scheme can be changed to make it work-conserving.
If we were to implement the scheduler with GPS instead,
we still would need the priority queue, but would
we no longer need to keep track of the virtual clock.
\section{Conclusion}
In this lecture, we have shown that with an appropriate
combination of traffic shaping
and EDD scheduling for a single session, we can get the same
worst-case delay bound as
GPS. Smoothing the traffic for session $i$
decreases the worst-case delays at the nodes, but
introduces an additional delay at the traffic shaper.
To do better than GPS, we must bring the service curve up. Since
the service curve for session $i$ depends on the traffic streams
from the other sessions, appropriate use of traffic shaping on
other sessions can smooth out their traffic streams and
improve the service curve for session $i$. In this manner,
we can actually get a better end-to-end delay bound than
what is possible through GPS.
\begin{thebibliography}{9}
\bibitem{par-1} Abhay K. Parekh and Robert G. Gallager, ``A Generalized Processor
Sharing Approach to flow control in Integrated Services Networks, Part I'',
{\em IEEE/ACM Transactions on Networking}, Vol.1, No.3, June 1993.
\bibitem{IBM}
L. Georgiadis, R. Guerin, V. Peris, K.N. Sivarajan (1995).
Efficient Network QoS Provisioning Based on per Node Traffic Shaping. {\em IBM Research Report}, (05/17/95), RC 20064, pp. 1-34.
\end{thebibliography}
\end{document}