algorithms for distributed data processing

18
Comput. Opns Res. Vol. 14, No. 2, pp. 145-162, 1987 0305-054X/87 $3.00 + 0.00 Printed in Great Britain. All rights reserved Copyright0 1987 Pergamon Journals Ltd ALGORITHMS FOR DISTRIBUTED DATA PROCESSING ARIE SEGEV* School of Business Administration, The University of California, Berkeley, CA 94720, U.S.A. (Received September 1985; revised April 1986) Scope and Purpose-This paper addresses a problem of processing on-line retrieval requests (queries) in distributed relational database systems. A mathematical model of the problem is developed, where the objective function is to minimize the communication cost incurred by inter-site data transfers. The resulting mathematical formulation is a linear integer program. A lower bounding procedure, based on a Lagrangean relaxation and sub-gradient optimization, is devised, and heuristic procedures are proposed. The lower bounds are used in an empirical evaluation of the heuristics. The computational experiments reveal good performance of the heuristic procedures. A reading of this paper requires a basic understanding of relational database systems (though some readers can gain it from this paper), computational complexity, integer programming, and Lagrangean relaxation. Abstract-This paper analyzes a problem that occurs in distributed database systems. The problem is how to minimize the communication cost incurred by inter-site data transfers that are associated with on-line retrieval requests. A mathematical model of the problem is developed and results in an NP-Complete integer linear program. A lower bounding procedure, based on a Lagrangean relaxation and sub-gradient optimization, is devised, and heuristic procedures are proposed. The results of computational experiments reveal good performance of the heuristic procedures. 1. INTRODUCTION One of the important problems in the design and implementation of Distributed Database Management Systems (DDBMS) is the efficient processing of data retrieval requests. Models that attempt to characterize and solve this problem have been developed by Apers et al. [ 1,2], Bernstein et al. [3], Wong [4], and others. The models developed differ in their methodology and do not follow a single approach. The results, derived by those models, differ substantially and depend on the assumptions made, such as objective function and parameters used by the model. For a survey, see [51* The subject of horizontal partitioning (fragmentation) has been discussed in several papers (see [6] and [7]). In this type of partitioning, a file is fragmented into several sets of records (usually disjoint sets), each stored at a different site. Horizontal partitioning of databases is an important case, since it is a natural partitioning in many real world environments. Examples to such industries include insurance, banking, credit cards, airline, hotel and car reservation systems, libraries and patient medical systems, to name only a few. The aforementioned systems have two main attributes that lead to a natural horizontal partitioning. The first is locality of reference [8], the main reason for which is the fact that most of the transactions which originate at a particular site need only the data associated with that site. As an example, most of the queries or transactions relating to an individual’s bank account, insurance policy or medical records originate from or close to his main area of residence, and relate to activities associated with a local office, branch, agent or service. The second attribute is the large size of those files, e.g. millions of books in libraries, millions of insurance policies and millions of credit cards. In these cases, the horizontal partitioning provides shorter response time and lower processing costs for local queries (queries that refer to local data). An additional advantage of fragmentation is a consistency, in many cases, with the organizational structure. This paper analyzes a problem that occurs in fragmented database systems. The problem is how to minimize the communication costs incurred by inter-site data transfers that are associated with on- line retrieval requests. A more comprehensive computer science-oriented coverage of the problem (without the mathematical programming details, which are presented in this paper) can be found in *Arie Segev is an Assistant Professor of Computers and Information Systems in the School of Business Administration at the University of California, Berkeley. He earned a Ph.D. in Computers and Information Systems at the Graduate School of Management, University of Rochester. Dr Segev is interested in optimization problems in the areas of database design, distributed processing, and the configuration of distributed computer systems. He has published several papers in these areas. 145

Upload: arie-segev

Post on 21-Jun-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithms for distributed data processing

Comput. Opns Res. Vol. 14, No. 2, pp. 145-162, 1987 0305-054X/87 $3.00 + 0.00 Printed in Great Britain. All rights reserved Copyright 0 1987 Pergamon Journals Ltd

ALGORITHMS FOR DISTRIBUTED DATA PROCESSING

ARIE SEGEV*

School of Business Administration, The University of California, Berkeley, CA 94720, U.S.A.

(Received September 1985; revised April 1986)

Scope and Purpose-This paper addresses a problem of processing on-line retrieval requests (queries) in distributed relational database systems. A mathematical model of the problem is developed, where the objective function is to minimize the communication cost incurred by inter-site data transfers. The resulting mathematical formulation is a linear integer program. A lower bounding procedure, based on a Lagrangean relaxation and sub-gradient optimization, is devised, and heuristic procedures are proposed. The lower bounds are used in an empirical evaluation of the heuristics. The computational experiments reveal good performance of the heuristic procedures. A reading of this paper requires a basic understanding of relational database systems (though some readers can gain it from this paper), computational complexity, integer programming, and Lagrangean relaxation.

Abstract-This paper analyzes a problem that occurs in distributed database systems. The problem is how to minimize the communication cost incurred by inter-site data transfers that are associated with on-line retrieval requests. A mathematical model of the problem is developed and results in an NP-Complete integer linear program. A lower bounding procedure, based on a Lagrangean relaxation and sub-gradient optimization, is devised, and heuristic procedures are proposed. The results of computational experiments reveal good performance of the heuristic procedures.

1. INTRODUCTION

One of the important problems in the design and implementation of Distributed Database Management Systems (DDBMS) is the efficient processing of data retrieval requests. Models that attempt to characterize and solve this problem have been developed by Apers et al. [ 1,2], Bernstein et al. [3], Wong [4], and others. The models developed differ in their methodology and do not follow a single approach. The results, derived by those models, differ substantially and depend on the assumptions made, such as objective function and parameters used by the model. For a survey, see

[51* The subject of horizontal partitioning (fragmentation) has been discussed in several papers (see [6]

and [7]). In this type of partitioning, a file is fragmented into several sets of records (usually disjoint sets), each stored at a different site. Horizontal partitioning of databases is an important case, since it is a natural partitioning in many real world environments. Examples to such industries include insurance, banking, credit cards, airline, hotel and car reservation systems, libraries and patient medical systems, to name only a few. The aforementioned systems have two main attributes that lead to a natural horizontal partitioning. The first is locality of reference [8], the main reason for which is the fact that most of the transactions which originate at a particular site need only the data associated with that site. As an example, most of the queries or transactions relating to an individual’s bank account, insurance policy or medical records originate from or close to his main area of residence, and relate to activities associated with a local office, branch, agent or service. The second attribute is the large size of those files, e.g. millions of books in libraries, millions of insurance policies and millions of credit cards. In these cases, the horizontal partitioning provides shorter response time and lower processing costs for local queries (queries that refer to local data). An additional advantage of fragmentation is a consistency, in many cases, with the organizational structure.

This paper analyzes a problem that occurs in fragmented database systems. The problem is how to minimize the communication costs incurred by inter-site data transfers that are associated with on- line retrieval requests. A more comprehensive computer science-oriented coverage of the problem (without the mathematical programming details, which are presented in this paper) can be found in

*Arie Segev is an Assistant Professor of Computers and Information Systems in the School of Business Administration at the University of California, Berkeley. He earned a Ph.D. in Computers and Information Systems at the Graduate School of Management, University of Rochester. Dr Segev is interested in optimization problems in the areas of database design, distributed processing, and the configuration of distributed computer systems. He has published several papers in these areas.

145

Page 2: Algorithms for distributed data processing

146 ARIE SEGEV

[7]. Section 2 introduces the basic database terminology, followed by problem definition. The mathematical notation, used throughout the paper, is presented in Section 3, and a mathematical programming formulation of the problem is presented in Section 4. A lower bounding procedure is described in Section 5, and a Lagrangian relaxation of the problem is derived in Section 6. Heuristic procedures are proposed in Section 7, the results of computational experiments are presented in Section 8, and Section 9 summarizes the paper.

2. RELATIONAL TERMINOLOGY AND PROBLEM DEFINITION

The problem analyzed in this paper occurs in relational database systems. The basic relational terminology is described using Fig. 1; more details can be found in [9] or a basic test such as [lo]. A relation is a simple file (e.g. Rl is a part file), and a database is a collection of relations. A row of a relation is a tuple, and a column is an attribute whose values are drawn from a domain. Projecting a relation on an attribute results in a set of the attribute’s values (duplicates are eliminated), e.g. projecting R2 on PART# (see Fig. 1) results in the set (100,300).

A semi-join operation between relation Rl and relation R2 restricts Rl by values that appear in one of Rl’s attributes and in one of R2’s attributes (those attributes are thejoin attributes). The semi-join operation has been established as a useful mechanism to reduce the amount of transmitted data, when processing queries in distributed databases [l-4]. Theoretical work on the semi-join operation can be found in [ 111. Figure 1 shows two sample relations Rl and R2, and the effect of semi-joining Rl by R2 over the join attributes Rl.PART# and RZ.PART# . Note that the semi-join is an asymmetric operator; semi-joining R2 by Rl would have no effect on the size of R2 in the example of Fig. 1. If relation Rl is semi-joined by relation R2 we will refer to Rl as the “restricted relation” and to R2 as the “restricting relation”.

A database is fragmented if one or more of its relations are partitioned horizontally. Figure 2 shows a fragmented database. The figure contains the same relations as Fig. 1, but relation R2 has been partitioned into two fragments, R2, and R2,, which are stored at site 2 and site 3 respectively. Suppose that Rl is to be semi-joined by R2 over PART # . It can be done by performing two semi- joins, one between Rl and R2, and the other between Rl and R2,. Note, however, that the resulting tuples of the two semi-join operations have to be unioned. Moreover, every fragment of the restricting relation must participate in a semi-join of the restricted relation (or fragment); otherwise, no tuple of the restricted relation (or fragment) can be eliminated.

The foregoing discussion has explained what has to be done in order to semi-join RI by R2, but not how to do it. A simple procedure is to project R2, and R2, over PART # at their respective sites, and send the two attributes to site 1, where the semi-join is performed. A more complicated procedure consists of the following steps (note that the restrictions are set intersections):

(1) Project Rl on PART# , resulting in Rl.PART# = { 100,200,300,400).

RI SEMI-JOINED BY R2

Fig. 1. A semi-join operation.

Page 3: Algorithms for distributed data processing

(2) (3) (4) (5)

(6)

Note

Algorithms for distributed data processing 147

Send copies of Rl.Part# to sites 2 and 3. Restrict Rl.PART# at site 2, resulting in .lil,.PART# = { lOO>. Restrict Rl.PART# at e 3, resulting in R1 .PART# = (300). - Send Rl .PART# and Rl .PART# back to site 1 and union the two sets, resulting in RLPART# = (100,300). Restrict Rl by &.PART# resulting in

Rl PART # COLOR WEIGHT

100 BLUE 20 300 BLUE 18

that Rl in this example might have been a fragment of some relation (other than R2), and the example would have looked exactly the same.

This paper analyzes the problem of semi-joining two fragmented relations, prior to their transfer to a query site, such that the resulting communication cost will be minimized. A proof that the problem is NP-Complete can be found in [ 121.

3. NOTATION

Let Rl and R2 be two relations. The following notation will be used henceforth:

Sl = the index set of sites among which relation Rl is fragmented,

S2 = the index set of sites among which relation R2 is fragmented,

T= Sl u s2,

I

S2, if iES1 Ti= Sl, if iES2

undefined, otherwise,

q = the index of the query site,

C, = the transmission cost rate between site i and site j,

R, = the fragment of relation R, stored at site i,

Fi = size of the fragment stored at site i,

Di = size of the projection of fragment i on the join attribute,

Rli c R2, = a semi-join between fragments Rli and R2,, where Rli is the fragment to be restricted,

aij = the selectivity factor for Rli c R5, i.e. the size of the result of Rli c R5 is Fiaij.

The plus and minus signs in a notation of the type “k E Sl + i”, will be used to represent the union of set Sl and the singleton i, and the removal of element i from the set Sl, respectively. If S is a set, ISI is its cardinality.

Site 3

R22 PART# DEPTX QTY 300 10 500 300 12 800

Fig. 2. A fragmented database.

Page 4: Algorithms for distributed data processing

148 ARIE SEGEV

Note. There is a one-to-one correspondence between a site number, fragment number, and join

attribute number, e.g. fragment 5 is stored at site 5 and the number of its join attribute is 5. Additional notation and definitions will be introduced as necessary.

4. A MATHEMATICAL PROGRAMMING FORMULATION

A mathematical programming formulation of the model is given as problem P, below.

decision variables, used in the formulation, are defined as follows:

Xi= 1, if fragment i is restricted by a semi-join

0, otherwise

Yijk = 1, if a semi-join Rli t R2,, i E Sl and j 6 S2, takes place at site k

0, otherwise

Wij~ = 1, if join attribute i is transferred from site j to site k

0, otherwise.

Problem PR :

min C FiC, 1 - I- 1 aij Xi + 1 C CDiCjklYijk+ C 1 CDiaijCkil’;ik 1i.r ( ( jer, ) > isTjcTkcT IcTjjcr,ksT

The

(1)

subject to :

iE TyjElYi (2)

iET, jETi, kET, k#t (3)

iET, jEri, kET, k#j (4)

i, k, t E T, k # ;, k # t, i # ( (5)

i,tET,t#i

i, k, t E T

i, k, t E T.

(6)

(7)

(8)

The first summation in (1) is the cost of sending fragments to the query site. The cost of transferring fragment i to the query site is FiC, if it is not restricted by semi-join operations, and FiC, xjer, aij ifit is restricted. The first triple summation accounts for the cost of sending unrestricted join attributes to semi-join sites, and the second accounts for the cost of sending restricted join attributes back to their original sites.

The constraints in (2) state that if a fragment is to be semi-joined, it has to be restricted by every fragment of the other relation. Constraints (3) and (4) say that in order for a semi-join to take place at a site, both of the join attributes must be available at that site. The constraints in (5) ensure that a join

Page 5: Algorithms for distributed data processing

Algorithms for distributed data processing 149

attribute can be transferred from site t to site k only if it is available at site t. Constraints (6) and (7) are the flow constraints that guarantee the tree structure of the transfers of each unrestricted join attribute (see [13] for an analysis of cycle prevention constraints).

5. A LOWER BOUNDING PROCEDURE

An important part of the analytical analysis of the problem is the provision of tight lower bounds on the value of an optimal solution to the model. Due to the inherent difficulty of the problem (a special case was proven to be NP-Complete in [12]) and its real-time nature, it is expected that heuristic rather than optimal solutions will be used for a real world application. The lower bounds, when compared to the value of heuristic solutions, provide information about the quality of the solutions generated by the heuristic procedures. For example, if in most cases the heuristic’s value is 1% greater than the optimal value, then probably there is no sense in devoting years of research to devise better algorithms. In the absence of lower bounds for the problem, the only way to compare the heuristics’ solutions to the optimal solution is by complete enumeration of the solution space. Conducting a significant empirical analysis using complete enumeration for sizable problems is likely to be too costly for most researchers.

Lower bounds are also needed if one wants to compute the optimal solution using a branch and bound algorithm [14]. Optimal solutions were not computed in the empirical analysis reported in this paper, due to the prohibitive amount of resources required. Hence, if the heuristic’s solution and the lower bound are 5 % apart, we know that the heuristic’s value is at most 5 % away from the optimum.

The lower bounds derived in this paper are based on a Lagrangian Relaxation coupled with a subgradient procedure (a description of the procedure is given below). Lagrangian Relaxation [ 151 has been applied successfully in many combinatorial optimization problems such as location problems [16-181, distribution systems design [19], the traveling salesman and related problems [20,21], and the design of computer networks [13].

A summarized description of the Lagrangian Relaxation follows. Interested readers can consult [ 151 for more details.

The general integer linear programming problem can be written as:

(P) min CX xao

subject to :

AX>b

BX>,d

Xi integer, i E I

where X, b, c and d are vectors, A and B are matrices of conformable dimensions, and the index set I denotes the variables required to be integer. It is assumed that the constraints BX > d have a special structure. We define the Lagrangian Relaxation of problem (P) relative to AX 2 b and a conformable non-negative vector 1. to be:

(PR,) min CX + l(b - AX) x20

subject to :

BXBd

Xi integer, i E I.

Denoting the value of an optimal solution to problem (P) by Z(P), we have the following relation:

Z(PRA) < Z(P).

Page 6: Algorithms for distributed data processing

150 ARIE SEGEV

Consequently, the Lagrangian Relaxation of(P) constitutes a lower bound on the optimal value of (P). For the relaxation to be useful, problem (PR,) has to be significantly easier to solve than problem (P). For a given Lagrangian Relaxation, the tightest lower bound which can be achieved is max, {Z(PR,)). The vector 12 which achieves that maximization is the best set of Lagrangian Multipliers.

The subgradient procedure is used to approximate the best Lagrangian multipliers. It is an iterative procedure which updates the vector 1 at each iteration based on the value Z(PR,). The main steps of the subgradient procedure are described below. For a detailed description of the procedure and its theory see [20,22].

The procedure starts with an initial vector 1’ and the optimal solution X0 to problem (PRp). For each iteration t, the subgradient direction vector is calculated as

Q’=b-AX’.

Using a step size S’, the new vector 12’+’ is given by

A common step size is

where g(P) is an upper bound (feasible solution) on the value of (P), /I * I/ denotes the norm function, and C’ is a scalar which is initially equal to 2 and is updated every k iterations.

The lower bound on the value of an optimal solution to the model is derived through a Lagrangian Relaxation of problem PR. The main idea in that relaxation is to reduce problem PR to a set of uncapacitated Plant Location problems. The Plant Location problem is concerned with a set of candidate plant sites, and a set of customers each with a demand for a commodity which can be supplied from any site at which there is an open plant. The objective function is to satisfy the customers’ demand and minimize the total cost, which consists of fixed costs of opening plants and variable costs of supplying the customers. Though NP-Complete [ 161, the Plant Location problem is considered to be “easy”. An optimization algorithm developed by [17] has exhibited excellent performance in many applications of the Plant Location problem. This procedure was used in the solution of the Lagrangian Relaxation of problem PR. The mathematical details of the relaxation are given in the next section.

6. LAGRANGIAN RELAXATION OF PROBLEM PR

Let 1 and y be vectors of non-negative Lagrangian multipliers associated with the constraints in (4) and the constraints in (5) respectively. Also, let p be a vector of Lagrangian multipliers associated with the constraints in (6). Then, the Lagrangian Relaxation of problem PR is achieved by multiplying the sum (over i E T) of constraints (4) by the multipliers I, the sum (over k E T) of constraints (5) by the multipliers y, constraints (6) by the multipliers c, and adding them to (1). The following definitions have been used to get a more concise representation of the relaxed problem:

~Lilr+~jk, ifkfiandkfj

ifk=iand k#j

ifkftand k=j

otherwise

Page 7: Algorithms for distributed data processing

Algorithms for distributed data processing 151

- A,, =

0, ifj=k

$V otherwise

ifi=korj=k

otherwise

Fijk =

0, ifi=korj=kori=j

Yij, otherwise

7ijk =

0, ifi=korj=k

Yik, otherwise

bijk = DiCjk - Irilx& + Fijk - (ITI - 2)?ijk

Pik - clij9 ifk#{and j#i

dijk = PikS ifk#{and j=i

0, otherwise.

The Lagrangian Relaxation of problem PR is given as problem PU below.

Problem PLR :

min {z FiCiq -f c cixi + 1 c c aijkYijk + c c c bijk%jk + c 1 c dukggk}

ieT iE T ie T js r, ke T ieTjeTksT ieTjaTkkcT t9)

subject to: (2), (3), (7) and (8).

As described in Section 5, the value of an optimal solution to problem Pwp is a lower bound on the value of an optimal solution to problem PR. The remainder of this section describes the derivation of a solution to problem PLR.

Problem PLR can be simplified by substituting for the variables Qi,~ in (9) as follows. Let w$k be the value of w,k in an optimal solution to problem PLR, then the values of variables gi,k in an optimal

solution to problem PLR are given by:

0, if W$k = 0

&k = 0, if w$ = 1 and d, > 0

WI, if Wck = 1 and d, < 0.

Defining,

and USiIIg the relatiOn dijkgijk = hijkWijk, problem Pwp reduces to the following problem:

Page 8: Algorithms for distributed data processing

152 ARIE SEGEV

subject to: (2), (3) and (8).

Holding the values of Isi,, yit, and ,u~ constant, problem PLR is separable over k 7: For every ie T we have the following problem:

Problem Pi: min CiX,+ 1 1 UijkYijk + C 1 hijkWijk jerikeT jsTkeT

subject to:

(11)

Yijk d C IYitk, jEri, kE T (13) fBT

Xi, yij&, Wijk E {O? l}, jEri, kET. (14)

Let Z*(P) be the optimal value of a generic problem P, then

Z*(P,,) = Z*(P;,) = 1 F,C, + c Z*(P;). IET IET

(15)

Equation (15) implies that we have to solve 1 TI problems Pi. In what follows it will be shown that each problem P: is essentially a plant location problem (see Section 5). Assume that the value of Xi in an optimal solution to problem P: is known. If Xi = 0, the values of Yijk and Wijk in the optimal solution are given by:

Yij& = 0, jEri, keT

Wijk = 1, if h, < 0

0, otherwise.

If Xi = 1, the remainder of problem Pi is a special type of a plant location problem, with a cluster of 1 TI plants at each site k E T, and cost coefficients which are unrestricted in sign. In this case, an equivalent interpretation of the decision variables and costs, conforming to a plant location problem, is given below.?

Wij, = 1, if plant i at site k is open

0, otherwise

Yijk = 1, if customer j is supplied from site k

0, otherwise

h, = the cost of opening plant i at site k

aijk = the cost of supplying customer j from site k.

In this interpretation, the constraints in (12) say that each customer must be supplied from one and only one site. The constraints in (13) state that a customer can be supplied from site k only if there is at least one open plant at that site.

tRemember that the subscript i is a constant for problem Pi.

Page 9: Algorithms for distributed data processing

Algorithms for distributed data processing 153

The problem can be transformed into a standard plant location problem in the following way. Replace each site k E T by a set of \T( sites, k,, . . . , kITI, and let T’ represent the expanded set T. Substitute each case UiJk, j E Ti, by a set of (TI costs ailk, = , . . . , = aijk(T\ = aijk, fix the plants with negative set up costs open (i.e. Wij, = 1 if h, < 0), and replace aijk by aiik + A, where

A = max (lUi,kl, such that aijk < O}.

jer, keT

However, performing this straightforward transformation will generate a new problem with plant cardinality of IT]‘. As the following set of Lemmas will show, it is possible to transform problem Pi (given that Xi = 1) into a standard plant location problem with ITI plants. The significance of these Lemmas is in enabling the use of standard routines for the solution of the plant location problem (e.g.

E171).

Lemma 1

Let XT, Y$k, W& be the values of the decision variables Xi, Yijk and Wijk, in an optimal solution to problem Pi (and hence to problem PLJ. If h, c 0, then Wsk = 1 for all j and k independently of the values of Xl and Ytk.

Proof

Case 1: XT = 0. It has been shown in the foregoing discussion that Wck = 1 if XT = 0 and h, c 0. Case 2: XT = 1. Assume that h, < 0 and W$, = 0. Let Zg(Pj) denote the value of (11) when Wtk = 0, and Z:(P:)

the value of (11) when W& = 1, given that the values of all other variables are being held constant. h, < 0 implies that Z:(P:) < Zg(P:), and setting w$k = 1 will not violate any of the feasibility constraints in (13) since It,, Witk is bounded only from below. Q.E.D.

Lemma 2

Let Y$ and w$ be the values of the decision variables qik and IVjk in an optimal solution to problem P:, and S = {t, such that hitk > O}. Then,

cW;k< 1, V kET. IS.9

Proof

Let Sk = {t, such that hitk > 0 and w$. = 11. Assume that Sk is an optimal set and that JS,J > 1. Let f be such that ZE Sk and h,rk = max, { h&}, and define Z*(S,) to be the value of (11) for a given set Sk. It will be shown that the set {Sk - r} is feasible and Z*(Sk) > Z*({S, - 7)). Since Sk is an optimal set, it follows from (13) that

y;k G c w:k + c WiTk, lES, rsT-S,

jEri, ke T. (16)

Since IS,\ > 1 and Y$ < 1 we can rewrite (16) as

(17)

If the second sum in (15) is greater than or equal 1, the set Sk G 0 is feasible and since hitk > 0, V t E Sk, Z*(S,) > Z*($,), a contradiction to the optimality of Sk. Otherwise, since I{S, - ?}I = (Sk1 - 1 b 1,

Page 10: Algorithms for distributed data processing

154 ARIE SEGEV

It follows from (18) that the set {Sk - 9 is feasible, and since hn > 0, Z*(S,) > Z*({& - t’)), a contradiction to the optimality of Sk. Using the same arguments as above, the set Sk can be reduced further until IS,.1 ,< 1. Then, it follows from (17) and the positivity of hitk, t E S, that

Is I={ 1, ifY$=l k

0, otherwise. Q.E.D.

Lemma 3

Let us assume that there exists an optimal solution to problem Pi with Xl = 1. For any EE T, if there exists hit,- < 0, and aiil = mi&T {aijk}, j E Ti, then th ere exists an optimal solution with,

‘~ = 1, if k=& 0, if k z L

Proof

Since XT = 1, we can write (12) as

zT yijk = 13 j E ri* (19)

It follows from (19) that there exists LE T such that for every j E Tiy Yji = 1 and Yij~ = 0, V k # F. It has to be shown that k= k: It follows from Lemmas 1 and 2 that wjf = 1, and (13) implies that setting Yjr = 1 is feasible. Letting ZL denote the value of (11) when Yiik = 1, j E Ti, k E T, and using the fact that ag = minka r {ai,k}, it follows that

a

.zh B zk, k # 6. Q.E.D.

If X: = 1, Lemmas 1 and 2 imply the following transformation of the remainder of problem P; into plant location problem.

(1) (2)

(3)

(4)

(5)

Let h,-, = mintcr{hitk}, k E T. For every k E T, if h,-, 6 0, open the plant at site k with a fixed cost fk equal to 0. Otherwise let the fixed cost be fk = hck.

Let the cost of supplying customer j from plant k be

cjk = aijk, jErir kc T,

and

w, = 1, if plant k is open

0, otherwise

yjk= 1, if customer j is supplied from plant k

0, otherwise.

Solve the plant location problem with the set of plants T, the set of customers Ti, the variables W, and Yjk, and the costs fk and C,. Define Z*(PL) to be the value of an optimal solution to the plant location problem, and

h’

i

h,-,, if h,i < 0 iik -

_

0, otherwise.

Then, the value of an optimal solution to problem Pi is given by

Z*(Pj) = Z*(PL) + Ci f C &. kcT

Page 11: Algorithms for distributed data processing

Algorithms for distributed data processing 155

Note that in step (2) of the transformation, it is not a must to fix the plant open, since zero fixed cost is equivalent to doing that.

Two optional types of pre-processing are implied by the foregoing discussion. The first type identifies variables W,, (Lemma 1) and Yi,~ (Lemma 3) which must be set to 1 in an optimal solution to problem Pi. The other type of pre-processing consists of finding a lower bound on the value of an optimal solution to the plant location problem. Since problem Pi is decomposed into two cases, Xi = 0 and Xi = 1, by having a lower bound on the value of an optimal solution to the plant location problem, we may be able to decide that the case Xi = 0 is optimal without solving the plant location problem. However, the computation of the lower bound should be efficient and significantly easier than solving the plant location problem. The lower bounding procedure adopted here is the Linear Programming (LP) relaxation of the plant location problem [23]. The following definitions are needed to describe the procedure. Let t” be the index that achieves mintcT (hitk}, and

l&k = max { 0, hi&}

K, = (k ) hiik < O> is the set of plants fixed open

K, = {k 1 hiik > 0} is the set of free plants.

Then, the LP relaxation of the plant location problem associated with problem Pi, is given by problem PL below.

Problem PL: min c

1 1 aijk Yijk + C EiikW-3 ‘aT,kcT keT

subject to:

The optimal solution to problem Pt (see [23]) is given by:

Yijk = 1, if a#r + 8 = e;

0, otherwise

I 1, if kEKO

Witk= Cj.r, Yijk if keK,.

1 lril ’

The above discussion leads to the following algorithm for the solution of problem P,,.

(20)

(21)

(22)

(23)

Algorithm 1

(1) For every iE T do steps (2)-(4).

(2) Perform pre-processing as described in Lemmas 1 and 3. (3) Let z1 (i) be a lower bound on the optimal value of problem P; given that Xi = 1. (4) If zl(i) 2 .Zg(P:), then Z*(P:) = Zg(P:), otherwise, Z*(P:) = min {Z,*(P$Zt(P;)). (5) Calculate Z*(P,,) from (15).

Page 12: Algorithms for distributed data processing

156 ARIE SEGEV

Steps (2) and (3) in Algorithm 1 are optional, and when the algorithm terminates, a lower bound on the value of an optimal solution to problem PR is available. This lower bound is used to evaluate the performance of the heuristic procedures developed in the next section.

7. HEURISTIC PROCEDURES

Three heuristic procedures are described in this section. The idea underlying the first heuristic is to decompose the problem into a set of single-semi-join problems which are efficiently solved by an algorithm developed in [24]. The second heuristic is an ADD procedure, and the third heuristic is a fast algorithm that consider each fragment only once.

7.1. A Single-Semi-Join Based Algorithm

Figure 3 shows a sample database consisting of five fragments. Fragment 1 belongs to relation Rl, and relation R2 consists of fragments 2-5. Assume that a decision was made to restrict fragment 1; a possible procedure to do it is shown in Fig. 3. The join attribute of fragment 1 is transferred to site 5, where it is restricted by join attributes 3,4 and 5, and to site 2, where it is restricted by join attribute 2. An heuristic developed in [24] can be used to determine how to restrict a single fragment (this problem will be referred to as the single-semi-join problem).

The idea underlying the heuristic proposed in this section is to select a set of fragments to be restricted by semi-join operations, and to apply Algorithm AH from [24] to each one of those fragments, followed by a routine to eliminate duplicate transmissions. The procedure is stated as Algorithm Hl below.

Algorithm HI

(1) Apply a set selection procedure whose output is the set M = {iI iE T and fragment i is to be restricted by a semi-join}.

(2) For every iE T solve the single-semi-join problem with the set of nodes {i + ri}, where i is the single fragment to be restricted.

(3) Eliminate duplicate transmissions.

Algorithm Hl consists of two conceptual parts. The first part determines the set of required semi- joins [step (l)], and the second part optimizes the data transmissions required to perform those semi- joins [steps (2) and (3)]. Two procedures, each of which can be used as step (1) of Algorithm Hl, are developed in the next two sections

7.2. An ADD Procedure

In this section, an ADD procedure is developed to derive a solution to problem PR. The ADD procedure is a greedy, [14], set selection heuristic which has been applied successfully to many

: __!..* -

fragment i

transfer of unrestricted join attribute i

transfer of restricted join attribute 1

Fig. 3. Transfers for a single fragment restriction.

Page 13: Algorithms for distributed data processing

Algorithms for distributed data processing 157

applications. ADD procedures differ from each other in the set to be selected, and the criteria for adding an element to the set. For some problems the selected set constitutes a solution while for others additional decision variables have to be determined. The value of an ADD procedure is that for a given selected set it is often easy to find an optimal or good solution for the rest of the decision variables. The ADD procedure used in this paper selects the set of fragments to be restricted by semi- join operations. Initially, this set is the empty set, and at each iteration it is augmented by the fragment which contributes most to the reduction in cost. If no such fragment exists the procedure terminates. The procedure is stated as Algorithm H2 below (a detailed description of Algorithm H2 is given in the Appendix). The following sets are used by Algorithm 2:

M is the set of fragments to be restricted by semi-join operations. N is the set of fragments yet to be considered for restriction. Li is the set of sites at which the join attribute of fragment i is available.

Algorithm H2

(1) (Initialization). Initialize M to the empty set, N to the set of all fragments, and Total Communication Cost to the cost of transmitting the unrestricted fragments to the query site. Li=(i},V iET.

(2) For every fragment in N calculate:

Net Cost = cost of semi-join - benefit of semi-join.

(3) Let 7 be the fragment with minimum Net Cost in step (2). If the Net cost of 2 is non-negative stop.

(4) Add the Net Cost of fragment ? to the Total Communication Cost. (5) Update the sets Li. (6) Remove i from N and add it to M. (7) If the set N is empty stop; Otherwise go to step (2).

When fragment i is considered for a restriction by fragment k the following alternatives are considered.

(1) Join attribute k is sent to the site of fragment i. Join attribute k is available at the set of sites L,, and the site which minimizes the communication cost of sending join attribute k to site i is chosen to be the sending site. The set Lk is augmented by {i} .

(2) Join attribute i is sent to site k^ belonging to the set L,. k^ is chosen such that the cost of sending join attribute i to site k^ and back (the restricted attribute) to site i is minimized. The set Li is augmented by {k).

If neither alternative is beneficial and the algorithm terminated, the unrestricted fragment is sent to the query site.

7.3. A Single Path Heuristic

In this section, a fast algorithm is proposed. The underlying idea is to examine each fragment only once (that is why we refer to the heuristic as a single path algorithm), and, if beneficial, to restrict it by semi-join operations. The procedure is stated as Algorithm H3 below (a detailed description of the algorithm is given in the Appendix).

Algorithm H3

(1) (Initialization). Initialize Ml and M2 to the empty sets, Nl to the set of Rl’s fragments, N2 to the set of R2’s fragments. Total Communication Cost to the cost of sending all unrestricted fragments to the query site, and Li = {i>, for every fragment i E T.

(2) For every fragment in Nl perform steps (3) and (4). (3) Net Cost = cost of semi-join - benefit of semi-join. (4) If Net Cost is negative then do:

(1) Add Net Cost to Total Communication Cost; (2) Update the sets Li; (3) Remove the fragment from Nl and add it to Ml.

Page 14: Algorithms for distributed data processing

158 ARIE SEGEV

(5) Replace Nl and Ml by N2 and M2 respectively, and repeat steps (2)-(4). (6) M = Ml + M2.

The logic of Algorithm H3 is basically the same as that of Algorithm H2, except that each fragment is considered only once. The set Ml consists of fragments of the first relation to be restricted by semi- join operations, and M2 is the set of fragments of the second relation to be restricted by semi-join operations. Nl and N2 are the sets of fragments yet to be considered for restriction. Calculating Net Cost and updating the sets Li in step (4) is done as explained for Algorithm H2.

8. COMPUTATIONAL EXPERIMENTS

In this section, we report the results of extensive computational experiments designed to evaluate the performance of the algorithms proposed in this paper. Section 8.1 compares the heuristic procedures to the lower bound developed in Section 6. Section 8.2 presents the results of a sensitivity analysis, which provides information both about the performance of each algorithm as a function of the system’s parameters, and about its performance relative to the other algorithms.

8.1. Heuristic Performance Relative to Lower Bound

Lower bounding and several heuristic procedures have been developed in this paper. Those procedures were programmed in FORTRAN and comparative computational experiments have been carried out. The objectives of the experiments reported in this section were to compare the heuristics to the lower bound, and to evaluate the required computing time as a function of the problem size. The programmed version of Algorithm Hl used Algorithm H2 in step (1) (only to determine the set of semi-joins), and Algorithm AH, [24], in step (2). The results of those experiments are summarized in Table 1. The experiments were based on the following data; the fragment size was drawn from a uniform distribution with a range of [ 10,201, the size of the join attribute ranged from 2 to 25 % of the fragment size, the unit transmission costs were uniformly distributed between 0 and 5, and the selectivity factors were drawn from a uniform distribution with a range of [0, 0.11. The results presented in Table 1 are the average values of nine problems, and the values of the lower bounds were derived by a Sub-Gradient procedure applied to the Lagrangian Relaxation of Section 6. Note that no specific units were assigned to the size and cost data, because the solution is effected by the relative and not absolute magnitudes of the problem’s parameters. Hence, the range [lo, 203 can be interpreted as 1OK to 20K, 10M to 20M, etc.

Based on the data presented in Table 1, it is evident that in most cases Algorithm Hl generates solutions with minimum communication costs among the three heuristic procedures, though at the expense of increased computation times. In general, all of the three heuristic procedures exhibited an acceptable performance and feasibility of an actual application.

Table 1. Performance of heuristics relative to the plant location lower bound

Relative cost* Algorithm H 1

Avg. Min M&Y. CPU+

Relative cost Algorithm HZ

Avg. Min. Max CPU

Relative cost Algorithm H3

Avg. Min. Max. CPU

5 2,3 10 2,8

5.5 15 2;13

728 20 5,15

IO,10 30 5,25

15,15 40 5.35

20,20

1.04 1.00 1.08 0.01 1.06 1.02 1.10 I .03 1.00 1.07 0.07 1.03 1 .Ol I .06 1.04 1.00 1.09 0.08 I .07 1.02 1.10 I .02 1.00 1.04 0.12 I .02 1.00 1.05 1.03 1 .Ol 1.05 0.30 1.06 1 .Ol 1.09 I .03 1 .Ol 1.06 0.62 1.03 1.00 1.09 1.05 1.01 1.08 0.75 1.08 1.03 1.1 I 1.01 1 .OO I .03 2.41 1.02 I .OO 1.04 1.03 1 .Ol 1.05 2.82 1.05 I .02 1.08 1.02 1.00 I.04 3.72 I .06 1.03 1.11 1.04 I .Ol 1.09 4.93 I .08 1.03 1.12

0.01 I .08 1.02 1.12 0.00 0.02 1.07 1.03 1.10 0.01 0.03 1.09 1.04 1.13 0.02 0.06 1.05 1.03 1.08 0.02 0.11 1.07 I .03 1.12 0.04 0.21 1.05 1.01 1.08 0.07 0.24 1.09 1.02 1.14 0.08 0.62 1.02 1.00 1.06 0.14 0.97 1.05 1.03 1.09 0.18 1.11 1.02 l.cil 1.04 0.24 1.36 1.06 1.04 1.09 0.26

*Relative cost of an algorithm = value of heuristic solution/lower bound tAverage CPU time, measured in IBM4341 s.

Page 15: Algorithms for distributed data processing

Algorithms for distributed data processing 159

8.2. Sensitivity Analysis

The sensitivity analysis experiments were designed to analyze the sensitivity of solutions, generated by the heuristic procedures, to various parameters of the models (except the number of fragments which was varied in Section 8.1). The model’s parameters chosen to be varied and the rationale for their selection are as follows:

(1) The selectivity factors

The values of the selectivity factors are likely to have a significant effect on the solutions generated by the five algorithms. Large selectivity factors may imply that semi-join operations will not significantly reduce the size of fragments, leading to solutions with similar costs generated by all three algorithms. For small values of the selectivity factors and not very small size of join attributes, it is expected that costs of solutions generated by the algorithms will differ from each other.

(2) The ratio of join attribute’s size to its ffagment’s size

The communication cost of semi-join operations is incurred by transferring join attributes. Hence, it is likely that join attributes whose size is small relative to their fragment will cause the algorithms to generate solutions which include more semi-join operations than solutions for the case of large join attributes. The difference among the heuristic procedures is the decision making process regarding the transfers associated with semi-join operations. Accordingly, one would expect larger differences among the costs of solutions when the number of semi-join operations is large. The purpose of the sensitivity analysis is to validate the above conjectures, and to determine what is “small” and what is “large”.

The input data that was fixed for all the sensitivity analysis experiments consisted of the number of fragments of the first relation (ISl) = 15), the number of fragments of the second relation (IS21 = lo), and the unit transmission costs (Cu - U(O,5)). The effect of changes in the values of the selectivity factors aii is shown in Fig. 4. Every point of the graphs in Fig. 4 is the average cost of nine sample problems. All costs were normalized by dividing them by the value of the minimum average cost. The selectivity factors were derived by first generating tli, - U(0, b), where b is the range’s upper limit as specified in Fig. 4, and then dividing Gil by Iril, SO that Bi = c ,eri ai, 6 b. d, may be viewed as the total selectivity factor of fragment i. The fragment size Fi was drawn from a uniform distribution with a range of [lo, 201, and the size of the join attribute Di was derived by generating di - U(O.O2,0.20) and multiplying it by Fi.

The results of the experiments validated the intuitive conjecture. For large values of the selectivity factors (pi,’ [0, b], b > 0.3) values of all solutions, generated by the three heuristic procedures, converged to the value of No Semi-Join Solution, i.e. sending all fragments, unrestricted, to the query site. Figure 4 demonstrates the effectiveness of semi-join operations when the selectivity factors are small (up to 50% reduction in cost occurred in the experiments).

The effect of the size of the join attribute relative to its fragment’s size is shown in Fig. 5. The input data to the experiments were the same as for the case of Fig. 4, except that the selectivity factors were

Range ot Selectivity Factors

Fig. 4. Effect of selectivity factors.

Page 16: Algorithms for distributed data processing

160 ARIE SEGEV

[OZ.051 [.05,.101 [15,.201 [25..301 [35..401 L.45501 [ 55..501 [ 70,.751

Range of Join Attribute Size

Fig. 5. Effect of join attribute size.

drawn from a fixed range (Crij N U(0, 0.5)), and the size ofjoin attributes (as a fraction of the fragment’s size) was drawn from a uniform distribution with a range of [a,b]. The costs of the generated solutions as a function of the range [a, b] are shown in Fig. 5. The behavior of the algorithms, as exhibited by the graphs in Fig. 5, is very similar to the case where the selectivity factors were varied. For large size of the join attributes, semi-join operations are not beneficial, even for small size of the selectivity factors, and the values of solutions generated by all three heuristic procedures converge to the value of No Semi-Join Solution.

9. SUMMARY

This paper has analyzed the problem of semi-joining two fragmented relations in distributed database systems. A mathematical model of the problem has been developed, and lower bounding and heuristic procedures have been proposed. The results of computational experiments have revealed good performance of the heuristic procedures, and demonstrated the benefit of using semi- join operations.

Two parameters of the model were found to have a substantial impact on the relative performance of the heuristic procedures. Those were the selectivity factors and the size of join attributes. Both parameters have had a similar effect on the relative performance. Large values of the selectivity factors and/or the size of join attributes reduced the differences among the values of solutions generated by the three heuristic procedures, due to increased number of fragments being transferred, unrestricted, to the query site.

The results presented in this paper have important practical implications. When a system designer is confronted with an actual system and a need to choose an optimization procedure, he or she can base the decision on the results of computational experiments, similar to the ones reported in this paper. For example, it has been demonstrated that for large values of the selectivity factor and/or the size of joining attributes, many of the fragments will be transferred directly to the query site. Hence, based on simulations of a particular system, it may be appropriate to establish cutoff points for the values of the cutoff points for the values of the parameters, above which there is no benefit in using a semi-join algorithm.

The importance of fragmentation has been stressed in Section 1. Given that type of data topology, semi-joining two relations is an important component of the system, since it is reasonable to assume that many of the retrieval requests will refer to two relations. The number of fragments in a Fragmented Database System could be large for a geographically dispersed organization. In that case, the problem’s complexity will render the use of optimal procedures too costly, and good heuristic procedures will have to be employed. The lower bounds developed in this paper can provide a system designer with valuable help in evaluating the performance of a particular algorithm. Current and future research in the area of Fragmented Database Systems includes the case of multiple joining attributes and the general case of n fragmented relations.

Acknowledgement--I would like to thank Professor Bezalel Gavish of the Graduate School of Management, University of Rochester for his helpful comments.

Page 17: Algorithms for distributed data processing

Algorithms for distributed data processing 161

1.

2.

3.

4.

5. 6.

7.

8.

9. 10. 11. 12.

13.

14. 15. 16.

17. 18.

19.

20. 21.

22.

P. M. G. Apers, Distributed query processing: minimum response time schedules for relations, Working Paper IR 53, Vrije University, Amsterdam (1979). P. M. G. Apers, A. R. Hevner and S. B. Yao, Optimization algorithms for distributed queries. IEEE Trans. Software Engng SE-9, 5768 (1983). A. P. Bernstein, N. Goodman, E. Wong, C. L. Reeve and J. B. Rothnie, Query processing in a system for distributed databases (SDD-1). ACM ‘Ifans. Database Syst. 6, 602625 (1981). E. Wong, Retrieving dispersed data from SDD-1: a system for distributed databases. Proceedings of the Third Berkeley Workshop on Distributed Data Management and Computer Networks, pp. 217-235 (1977). C. T. Yu and C. C. Chang, Distributed query processing. ACM Comput. Suru. 16, 399-433 (1984). G. Pelagatti and F. A. Schreiber, A model of an access strategy in a distributed database system. IFIP-TC2, Database Architecture, Venice (1979). A. Segev, Optimization ofjoin operations in horizontally partitioned database systems. ACM Trans. Database Syst. 6,48- 80 (1986). R. W. Peebles and E. D. Manning, A computer architecture for large (distributed) databases. Proceedings of the Conference on Wry Large Databases, Framingham, Mass. (1975). E. F. Codd, A relational model for large shared data banks. Commun. ACM 13, 909917 (1970). C. J. Date, An Introduction to Database Systems. Addison-Wesley, New York (1981). A. P. Bernstein and D. W. Chiu, Using semi-joins to solve relational queries. J. ACM Zs, 25-40 (1981). A. Segev, Optimizing 2-way joins in fragmented database systems. Working Paper MS-2, School of Business Administration, University of California, Berkeley (1983). B. Gavish, Topological design of centralized computer networks-formulations and algorithms. Networks 12, 355-377 (1982). E. Horowitz and S. Sahni, Fundamentals of Computer Algorithms. Computer Science Press, New York (1978). A. M. Geoffrion, Lagrangian relaxation and its uses in integer programming. Math. Progr. Study 2, 82-114 (1974). G. Comuejols, M. L. Fisher and G. L. Nemhauser, Location of bank accounts to optimize float. Mgmt Sci. 23,789-810 (1977). D. Erlenkotter, A dual based procedure for uncapacitated facility location. Opns Res. 26, 992-1009 (1978). A. M. Geoffrion and R. McBridge, Lagrangian relaxation applied to capacitated facility location problems. AIIE Trans. 10, 4@-47 (1978). A. M. Geoffrion and G. W. Graves, Multicommodity distribution system design by Benders decomposition. Mgmt Sci. 20, 822-844 (1974). M. Held and R. M. Karp, The traveling salesman problem and minimum spanning trees. Opns Res. 18,1138-l 162 (1970). B. Gavish and S. K. Srikanth, Optimal solution methods for large scale multiple traveling salesman problem. Working Paper, The Graduate School of Management, University of Rochester, Rochester, N.Y. (1980). C. Sandi, Subgradient optimization. In Combinatorial Optimization (Edited by N. Christofides, A. Mingizzi, P. Toth and C. Sandi). Wiley, New York (1979).

23. M. A. Effroyomson and T. L. Ray, A branch-bound algorithm for plant location. Opns Res. 14 (1966). 24. B. Gavish and A. Segev, Set query optimization in distributed database systems. ACM Trans. Database Syst. In press.

REFERENCES

APPENDIX

A Detailed Description of Algorithms H2 and H3

Algorithm H2

(1) (2)

(Initialization). M = 0; N = T- M; L, = {k}, V k e T; C = 0. For every ie N evaluate Bi:

ai=Fi(l-js:ij]C,

bi = 1 kc ri

min {DkCji}, min {Di(C, + a,C,,)j je&

Bi=bi-ai.

(3) Let i_be the index i which achieves minieN {Bi}. If Bra 0 goto step (8). (4) C=C+Br. (5) For every k E Ti,

(6) (7)

(8)

If $:{DkCjt} < nIini{Di(Ce + a&cjr)}

then Lk = 4 + {i} otherwise, Lr = L; + {k} M=M+{q; N=N-{i). If N # 0 go to step (2).

Total cost = c F,C, + C. i.z T

Page 18: Algorithms for distributed data processing

162 ARIE SEGEV

I=Sl; J=S2.

Algorithm H3 (1) (Initialization).Mr=MJ50;N,=I-M,;NJDJ-MJ;L~=(k},VkE~I:=O0,

(2) For every ie NI do steps (3) and (4).

(3) Calculate: ai= Fi C,

(4) If a, z bi then do:

c=c+(bi-a,)

Ml=Ml+{i); Nl=Nl-{i}

For every k E J,

then Lk = Lk - {i}

otherwise, Li = Li + {k).

(5) Replace I by J and J by I, and repeat steps (2)-(4).

(6) M = MI + MJ.

(7) Total cost = c F,C, f c. icT