Java Reference
In-Depth Information
8.3.1
Computing the cost of a distributed deployment
Figure 8.4 shows an ER diagram for a classic EJB implementation of an invoice
solution. If we decide to deploy this solution with distributed entity beans,
and if our controller and JSP are on the client, we'll need to populate the fields
on our user interface based on the fields in the model. While single communi-
cation round-trips are not expensive, we have containment relationships that
can get out of hand in a hurry. Table 8.2 shows the fields, multipliers, and
costs associated with displaying a view of this model.
Table 8.2 Without a façade layer, individual fields must be accessed one at a time. If a field points
to an object (such as Customer) or collection (such as Items), then those individual pieces must
also be retrieved. These nested costs can multiply quickly. The costs for these composite fields are
shown in bold.
Number
of round-trips
Total number
of round-trips
Object
Contents
Invoice
Id
Date
Customers
Items
1 +
1 +
8 +
4N =
10+4N
Customer
Name
ID
Addresses
1 +
1 +
6 =
8
Addresses
(for 2 addresses)
Id
Street
City
2 +
2 +
2 =
6
Items
(for N items)
Quantity
Products
1N +
3N =
4N
Products
(for N items)
ID
Name
Price
1N +
1N +
1N =
3N
To compute the total cost, it is best to go out to the leaf nodes and work back
to the root object. Table 8.2 shows the leaf nodes at the bottom and works up
to the root Invoice class. For the variable costs, we have three fields per prod-
uct and one field in the item, for a total of four units per item. For the fixed
costs, we have a customer with two addresses (eight fields), and two fixed
Search WWH ::




Custom Search