Question 1 of 11 · CIE-1 QB · Set 2 · 7 marks
Open in ChatGPTExplain Architectural Styles and System Architectures with suitable diagrams and examples. Explain the client-server, peer-to-peer, and hybrid architectural styles. How do architectural styles differ from system architectures?
Introduction
An architectural style is a principled way of organizing a distributed system: which components exist, and how they are connected. The system architecture is the concrete instance of that style: the actual machines, links and processes deployed.
Common styles
- Layered. Components are stacked in layers; each layer uses only the layer below and serves only the layer above. A web application split into presentation, application logic and database is layered.
- Client-server. Clients request, servers provide. This is the style most distributed systems build on (see the question on clients and servers).
- Object-based. Components are objects behind an interface, called remotely (CORBA, DCOM, RMI).
- Data-centred (repository). Components share one data store and communicate only through it. A transaction-processing system writing to a common database is data-centred.
- Event-based (publish-subscribe). Components publish events and other components subscribe to them. The publisher does not know who consumes the event: a stock-feed that pushes price changes to many subscribers.
- Peer-to-peer. All nodes are equal; each acts as both client and server. BitTorrent splits a file across peers who exchange blocks directly.
- Hybrid. Two or more styles combined: a client-server front end over a peer-to-peer back end, as in a BitTorrent tracker plus peers.
Diagram
Architectural style vs system architecture
| Architectural style | System architecture |
|---|---|
| Describes what kind of components and connections are allowed | Describes the actual components and where they run |
| Says components are layered clients and servers | Says two web servers, one application server and three database replicas |
| Decided at design time, before deployment | Decided by the capacity, performance and reliability target |
| A rule: how to structure | An instance: what was built |
Example
The university portal uses a layered, client-server style: a browser talks to a web server, the web server talks to an application server, the application server talks to a database. Its system architecture is: one load balancer, two web servers, one application server, one primary database and two replicas.
Conclusion
The architectural style constrains the possible designs; the system architecture chooses one of them for a given load and budget. Confusing the two is the usual cause of a design that looks layered on paper but is a single machine in practice.