REST 阅读 (2) - Network-based Architectures

CHAPTER 2 Network-based Application Architectures
2.1 Scope
2.1.1 Network-based vs. Distributed
The primary distinction between network-based architectures and software architectures in general is that communication between components is restricted to message passing, or the equivalent of message passing if a more efficient mechanism can be selected at runtime based on the location of components。
a distributed system is one that looks to its users like an ordinary centralized system, but runs on multiple, independent CPUs. In contrast, network-based systems are those capable of operation across a network, but not necessarily in a fashion that is transparent to the user.

2.1.2 Application Software vs. Networking Software
Applications represent the “business-aware” functionality of a system。

2.2 Evaluating the Design of Application Architectures
Keeping in mind that architecture is the realization of an architectural design and not the design itself.
Architecture can be evaluated by its run-time characteristics, but we would obviously prefer an evaluation mechanism that could be applied to the candidate architectural designs before having to implement all of them.
In order to evaluate an architectural design, we need to examine the design rationale behind the constraints it places on a system, and compare the properties derived from those constraints to the target application’s objectives.
The first level of evaluation is set by the application’s functional requirements.
Building a derivation tree provides a mechanism for architectural design guidance.
Since it is rarely useful to compare architectural designs across different application domains, the simplest means of ensuring consistency is to make the tree domain-specific.
Design evaluation is frequently a question of choosing between trade-offs.
I prefer to present all of the information to the architect in a readily viewable form, and let the architect’s intuition be guided by the visual pattern.

2.3 Architectural Properties of Key Interest
2.3.1 Performance
The performance of a network-based application is bound first by the application requirements, then by the chosen interaction style, followed by the realized architecture, and finally by the implementation of each component. Network Performance
Network performance measures are used to describe some attributes of communication.
Styles impact network performance by their influence on the number of interactions per user action and the granularity of data elements. User-perceived Performance
User-perceived performance differs from network performance in that the performance of an action is measured in terms of its impact on the user in front of an application rather than the rate at which the network moves information. The primary measures for user perceived performance are latency and completion time.
It is important to note that design considerations for optimizing latency will often have the side-effect of degrading completion time, and vice versa.
Balancing these tradeoffs can be difficult, particularly when it is unknown whether the recipient cares more about latency (e.g., Web browsers) or completion (e.g., Web spiders). Network Efficiency
An interesting observation about network-based applications is that the best application performance is obtained by not using the network. This essentially means that the most efficient architectural styles for a network-based application are those that can effectively minimize use of the network when it is possible to do so, through reuse of prior interactions (caching), reduction of the frequency of network interactions in relation to user actions (replicated data and disconnected operation), or by removing the need for some interactions by moving the processing of data closer to the source of the data (mobile code).
2.3.2 Scalability
Scalability refers to the ability of the architecture to support large numbers of components, or interactions among components, within an active configuration.

2.3.3 Simplicity
The primary means by which architectural styles induce simplicity is by applying the principle of separation of concerns to the allocation of functionality within components.
Applying the principle of generality to architectural elements also improves simplicity, since it decreases variation within architecture.

2.3.4 Modifiability