*** Welcome to piglix ***

Service granularity principle


In the context of software engineering and software architecture, service granularity is a key design concern when applying the paradigm of service-orientation for instance during service-oriented modeling. Service granularity specifies the scope of business functionality and the structure of the message payload in a service operation that is provided within a Service-Oriented Architecture (SOA).

Service granularity is both an application domain concern (business granularity), as well as a software interface design issue (technical granularity); it is a property of the service contract exposed by a service provider. It pertains to the semantics and syntax of the in (request) and out (response) message content, which can be viewed as instances of two general Enterprise Integration Patterns, Command Message and Document Message. By definition a coarse-grained service operation has broader scope than a fine-grained service, although the terms are relative. The former typically requires increased design complexity but can reduce the number of calls required to complete a task.

Due to the fallacies of distributed computing, finding an adequate granularity is hard. There is no single simple answer but a number of criteria exist (see below). A primary goal of service modeling and granularity design is to achieve loose coupling and modularity, which are two of the essential SOA principles, and to address other architecturally significant requirements.

Many forces influence the service granularity; four particularly relevant factors to consider when designing for an adequate granularity are performance, message size, transactionality and business function:


...
Wikipedia

...