cs0501069/analysis-lkpcost.tex
1: \subsection{Cost of Finger Stabilizations and Lookups}
2: 
3: %\begin{figure}
4: %	\centering
5: %		\includegraphics[height=7cm, angle=270]{l}
6: %	\caption{Theory and Simulation for $L(r,\alpha)$}
7: %	\label{fig:l}
8: %\end{figure}
9: 
10: In this section, we demonstrate how the information
11: about the failed fingers and successors can be used to predict
12: the cost of stabilizations, lookups or in general the cost for
13: reaching any key in the id space. By cost we mean the number
14: of hops needed to reach the destination {\it including }
15: the number of timeouts encountered en-route. 
16: %I a lookup originates at node $n$ and the sought key is between $n$ and  its successor $n.s_1$, 
17: %and $n.s_1$ is alive, one hope will be  made to $n.s_1$ which answers the query 
18: %and this is counted as one hop. 
19: %If $n.s_1$ is dead and the second successor $n.s_2$ is used in its stead, 
20: %then the lookup has taken one time out (timing out on $n.s_1$) + one hop (to $n.s_2$) , and so on.
21: For this analysis, we consider timeouts and hops to add  equally 
22: to the cost. We can  easily generalize this analysis to investigate the case 
23: when a timeout costs some factor $n$ times the cost of a hop. 
24: 
25: Define $C_{t}(r, \alpha)$ (also denoted $C_{t}$) to be the expected cost for a given node 
26: to reach some target key which is $t$ keys away from it (which
27: means reaching the first successor of this key). For example, 
28: $C_1$ would then be the cost of looking up the adjacent key ($1$
29: key away). Since the adjacent key is always stored at the
30: first alive successor, therefore if the first successor is 
31: alive (occurs with probability $1-d_1$), the cost will be $1$ hop.
32: If the first successor is dead but the second is alive (occurs with probability
33: $d_1(1-d_2)$), the cost will be 1 hop + 1 timeout = $2$ and the \emph{expected} cost is
34: $2 \times d_1(1-d_2)$ and so forth. Therefore, we have $C_1= 1-d_1 +  2 \times d_1(1-d_2) + 3 \times d_1 d_2 (1-d_3)+ \dots
35: \approx 1 + d_1 = 1+1/(\alpha r)$. 
36: 
37: For finding the expected cost of reaching a general distance $t$ we need
38: to follow closely the Chord protocol, which would lookup $t$ by first finding 
39: the closest preceding finger.
40: For notational simplicity, let us define $\xi$ to be the start of the finger (say the $k^{th}$)
41: that most closely precedes $t$. Thus $t = \xi+m$,
42: i.e. there are $m$ keys between the sought target $t$ and the start of the most closely preceding
43: finger.  With that, we can write a recursion relation for $C_{\xi+m}$ as follows:
44: 
45: \begin{equation}
46: \begin{split}
47: &C_{\xi+m} =  C_{\xi} \left[1-a(m)\right]  						\\
48: 				         &+ (1-f_k)\left[a(m)+ \sum_{i=1}^{m} b_{m+1-i}C_{i}\right]					
49:           \\					 
50: 					 &+ f_k  a(m) \biggl[ 1 + \sum_{i=1}^{k-1} h_k(i) \\
51: 					 &\sum_{l=1}^{\xi/2^i}bc(l,\xi/2^i)(1+C_{\xi_i+1-l+m}) + 2h_k(k) \biggr]
52: %					 &+ \biggl[ f_k  a(m) \\
53: %					 &+f_k  a(m)\sum_{i=1}^{k-1} h_k(i) \sum_{l=1}^{\xi/2^i}bc(l,m)(1+C_{\xi_i(k)+1-l+m}) + 2h_k(k)\biggr] 
54: \end{split}					
55: \end{equation}
56: 
57: where $\xi_i \equiv \sum_{m=1,i} \xi/2^{m}$ and $h_k(i)$ is the 
58: probability that a node is forced to use its $k-i^{th}$ finger owing to the 
59: death of its $k^{th}$ finger.
60: The probabilities $a,b,bc$ have already been introduced in section 3.
61: 
62: The lookup equation though rather complicated at first sight 
63: merely accounts for all the possibilities that
64: a Chord lookup will encounter, and deals with them 
65: exactly as the protocol dictates. The first term accounts for
66: the eventuality that there is no node intervening between $\xi$ and $\xi+m$
67: (occurs with probability $1-a(m)$). 
68: In this case, the cost of looking for $\xi + m$ is the same
69: as the cost for looking for $\xi$. The second term accounts for
70: the situation when a node does intervene inbetween (with
71: probability $a(m)$), and this node is alive (with probability $1-f_k$).
72: Then the query is passed on to this node (with $1$ added to
73: register the increase in the number of hops) and then the cost depends on
74: the length of the distance between this node and $t$.
75: The third term accounts for the case when the intervening node is dead
76: (with probability $f_k$). Then the cost increases by $1$ (for a timeout)
77: and the query needs to be passed back to the closest preceding finger.
78: We hence compute the probability $h_k(i)$ that it is passed
79: back to the $k-i^{th}$ finger either because the intervening fingers 
80: are dead or share the same finger table entry as the $k^{th} $ finger. 
81: The cost of the lookup now depends on the remaining distance to the sought key.
82: The expression for $h_k(i)$ is easy to compute using theorem $3.1$
83: and the expression for the $f_k$'s \cite{ansary:analysis}.
84: 
85: The cost for general lookups is hence 
86: $$
87: L(r,\alpha) = \frac{\Sigma_{i=1}^{{\cal K} -1} C_i(r,\alpha)}{\cal K} 
88: $$
89: 
90: The lookup equation is solved recursively, given the coefficients
91: and $C_1$. We plot the result in Fig \ref{fig:w}.
92: The theoretical result matches the simulation very well. 
93: 
94: