• No results found

Algorithms for QoS Query on Individual Services

Chapter 2: Background and Fundamentals

4.3 Algorithms for Answering a User’s QoS Query

4.3.1 Algorithms for QoS Query on Individual Services

Recall the model we defined in Section 4.2.1.3. Our goal is to compute the query result of a QoS query vector pon a group of servicesS,R(p,S), i.e., the set of all the services∈S, each of which is not dominated by any other service∈S.

A na¨ıve Approach

A na¨ıve strategy for the QoS query is to compute the individual quality difference of every service in Sand then, for each quality difference, make dominance checking with all the other quality differences to find the satisfying services. However, the na¨ıve strategy is ex- pensive since every two quality differences are compared. If we consider the rapid increase of available services, the cost of the na¨ıve approach would be even more expensive.

The RC Algorithm

The main cost the na¨ıve approach is the duplicate comparison between quality differences. This algorithm, calledReduce Comparison(RC) approach, tries to reduce the number of comparisons by using the comparing result already available. It traverses all the services in Sand maintains a setRto keep the satisfying services obtained so far. For each services, the RC algorithm checks ifsis dominated by a service inRwith respect to the query vector p. We discard s if it is dominated; otherwise we insert it toRand discard those services inR dominated bys. When all services in S have been traversed, the RC algorithm ends and returnsRas the QoS query result. Detailed steps of the RC algorithm are presented in Algorithm 4.1.

105

input : A QoS query vector p, A group of servicesS

output: A query result setRcontaining satisfying services R=φ;

1

foreachservice s∈Sdo

2

ifthere exists a service s0∈R such that s0Âs with respect to pthen

3 discards; 4 else 5 insetstoR; 6

remove every services0∈Rsuch thatsÂs0with respect top;

7 end 8 end 9 returnR; 10

R-tree Based RC Algorithm (RCC)

input : A QoS query vector p, an R-treeT indexing a group of servicesS

output: A query result setRcontaining satisfying services R=φ;

1

insert into the heap all entries of the root node ofT;

2

whileheap not emptydo

3

remove top entryE;

4

ifthere exists a service s0∈R such that s0ÂE with respect to pthen

5

discardE;

6

else

7

ifE is an intermediate entrythen

8

foreachchild eiof E do

9

ifeiis not dominated by a service s0∈R with respect to pthen

10

inseteiinto the heap;

11 end 12 end 13 else 14 insertEtoR; 15

//E is a leaf entry, i.e. the quality vector of an individual service;

16 end 17 end 18 end 19 returnR; 20

107

The RC algorithm outperforms the na¨ıve approach, as it avoids duplicate comparisons. However, the performance of RC algorithm may decrease as the number of services in R increases. To overcome the problem, the R-tree based RC algorithm (RRC) is proposed to facilitate the retrieval of services. Following most methods in the relevant references, we index the metric values of each quality vector corresponding to each service in S. An intermediate entry Ei corresponds to the minimum bounding rectangle(MBR) of a node Ni at the lower level, while a leaf entry corresponds to a quality vector. The dominance relationship between services can be easily determined by bound check similar to BBS algorithm in [97]. In the RRC algorithm, the maximum quality difference between p and a MBR, say E (i.e., intermediate entry), denoted as Dmax(p,q(E)), equals to the quality distance of its lower bound (e.g. the lower-left corner point in two dimension space) quality vector with respect to p, while theminimum quality differencebetween pandE , denoted as Dmin(p,q(E)), equals to the quality distance of its upper bound (e.g. the higher-right corner point in two dimension space) quality vector with respect to p. We say a services dominates a MBRE, if the following equation holds: D(p,q(s))≤Dmin(p,q(E)), and the inequality is strict on at least one QoS metric, as in this case service s must dominate all services inE.

Based on the explanations above, we show how the algorithm works: it starts with the root node of the R-tree and inserts all its entries in a heap. If an entry is not dominated by the query quality vector p, then we expand it. That is to say it is removed from the heap and all its children are inserted into the heap. This process repeats until the heap is empty. Detailed steps of RCC algorithm are presented in Algorithm 4.2. As our experiments verified, the RRC algorithm is efficient and its performance is much better than RC.