It's often recommended that services be coarse-grained. However, aside from the problem of defining when a service's granularity becomes "coarse" (see Coarse-Grained), this recommendation is highly influenced by its link to performance:
When the overhead of many fine-grained service calls compared to one coarse-grained service call becomes too high (as discussed in the previous section), performance concerns may lead to coarser-grained services.
On the other hand, when the price for processing more data becomes too high, performance concerns may lead to finer-grained services.
The latter topic will be discussed in this section.
The example I'll use here is that of a service provided by a company's CRM system. One of the first services this system provided was a service returning all customer data. Of course, "all customer data" could include several hundred attributes–besides data such as the customer ID and associated addresses and payment methods on record, the information returned could include all contracts and even all invoices and payments on record. In this example the company was a phone company that returned all phone contracts as part of the customer portfolio.
As discussed in the first section of this chapter, processing a service request can result in a significant performance penalty. And indeed, loading all customer data could take a significant amount of time (especially when the customer was a good customer with many contracts).
One day, ...