Physical architecture layer design: client-server, cloud, nonfunctional requirements
Distributing the four components of an application (data storage, data access, business logic, presentation) onto hardware: server-based, client-based, 2/3/n-tier client-server, cloud (IaaS/PaaS/SaaS); moving from nonfunctional requirements to architecture and the hardware/software specification.
Analysis is finished and the models are balanced. The first big decision in design: on which machines will this software run, and how will its parts be distributed? The physical architecture layer answers this question. What determines the decision is the nonfunctional requirements you gathered in week 5: performance, security, the operational environment, cultural and political constraints. The exam brings a comparison of architecture types, cloud models and the scenario “which architecture for these requirements”; sometimes an availability calculation.
Golden rules:
- Every application has four jobs: data storage, data access, business logic, presentation. The architecture is where these run.
- Thin client = presentation only. The business logic is on the server.
- Nonfunctional requirements choose the architecture, not the other way round.
- The availability calculation: downtime = total time × (1 − ratio). For components in series, the ratios are multiplied.
The four basic components
| Component | What it does | In a food ordering app |
|---|---|---|
| Data storage | Stores the data | Menu, order, customer tables |
| Data access logic | Operations that access the data | The query “fetch the open orders of this restaurant” |
| Application logic | Business rules | Delivery fee calculation, courier assignment |
| Presentation logic | Display and input | The menu screen, cart, buttons |
Architecture types
Server-based architecture
All four components run on a central server (formerly a mainframe); the client is just a terminal that sends keystrokes and displays the screen.
- Pro: central control, security, maintenance in one place.
- Con: the server becomes a bottleneck, and growing it is expensive and not incremental (you have to buy a new and much bigger server).
Client-based architecture
The client does presentation, business logic and data access; the server only stores files (a file server).
- Pro: simple, easy to develop.
- Con: all the data is carried over the network to the client, so the network load is large; performance drops with many users.
Client-server architecture
The work is split: the client is responsible for presentation and the server for the data; the business logic is distributed to the two or to separate servers.
Two-tier
[Client: presentation + app logic]
|
[DB server: data access + storage]
Three-tier
[Client: presentation]
|
[App/web server: application logic]
|
[DB server: data access + storage]
N-tier
[Client] - [Web srv] - [Order svc]
- [Payment svc]
- [DB server]
| Advantage | Disadvantage | |
|---|---|---|
| Client-server in general | Scalable (add servers), different platforms work together, business logic can be centralized | Complex; software and updates for several tiers; middleware is needed |
| Two-tier | Simple | Business logic on the client → updates are hard, fat client |
| Three-tier / n-tier | The load is balanced, each tier grows separately, a thin client is possible | Network traffic and design complexity increase |
Middleware is intermediary software that lets software on different tiers talk to each other (message queues, API gateways).
Thin vs thick client: A thin client does only presentation (a web browser). A thick (fat) client also runs part of the business logic (some desktop or mobile applications). A thin client is easy to maintain; a thick client can work offline and reduces the server load.
Comparison
| Criterion | Server-based | Client-based | Client-server |
|---|---|---|---|
| Infrastructure cost | Very high | Medium | Low-medium |
| Development cost | Medium | Low | High |
| Ease of development | Low | High | Low-medium |
| Interface richness | Low | High | High |
| Control and security | High | Low | Medium |
| Scalability | Low | Medium | High |
Cloud computing
Hardware and software resources are rented over the internet on a pay-as-you-go model. At its basis is virtualization: one physical server runs several virtual machines.
| Model | The provider gives | You manage | Example use |
|---|---|---|---|
| IaaS | Virtual machine, storage, network | Operating system, runtime, application, data | Renting a VM without setting up your own server |
| PaaS | IaaS + operating system, runtime, database service | Application code and data | Upload your code and let the platform run it |
| SaaS | The whole ready-made application | Only usage and settings | Web-based e-mail, office software |
Pros: low initial investment, fast growth (elasticity), maintenance is with the provider. Cons: dependence on the provider (vendor lock-in), where the data sits (legal compliance), cost in the long run, dependence on an internet connection.
Other concepts: ubiquitous computing / Internet of Things (sensors, turnstiles and smart devices connect to the system), green IT (energy efficiency, fewer physical servers with virtualization).
From nonfunctional requirements to architecture
| Category | Sub-requirements | Effect on the architecture |
|---|---|---|
| Operational | Technical environment, system integration, portability, maintainability | Which platforms, which external systems to connect to; a thin client makes maintenance easier |
| Performance | Speed, capacity, availability and reliability | Number of servers, load balancing, backup, cloud elasticity |
| Security | Value of the system, access control, encryption and authentication, virus control | Put the database in a separate protected tier, HTTPS, firewall |
| Cultural and political | Multilingualism, customization, unwritten norms, legal requirements | Data storage region (the Turkish data protection law, KVKK), multilingual interface, local currency |
Availability calculation
Availability is the proportion of time the system is usable. A year is 365 × 24 = 8,760 hours.
A Annual downtime
99% 87.6 hours
99.5% 43.8 hours
99.9% 8.76 hours (525.6 min)
99.99% 52.56 min
Components in series: If the web server (99%) and the database (99.5%) must work together:
The total is lower than even the weakest link. The solution: redundant servers, a load balancer.
Capacity estimation
In the campus food app, 2,000 active users at lunch break, about 5 requests per minute per person:
2,000 x 5 = 10,000 requests/min
10,000 / 60 ≈ 166.67 requests/s
The server is chosen according to this peak value and a safety margin.
Worked example: the architecture decision for FitHub
Requirements:
- O1. Members access it through a mobile app and the web; turnstiles (IoT) do check-in. (operational)
- P1. 1,500 concurrent users across 5 branches between 18:00 and 21:00. (performance)
- P2. 99.9% availability; if the turnstile does not work, a member cannot get in. (performance)
- S1. Card data will not be stored; payment is with an external provider. (security)
- C1. Personal data will be stored in Turkey or in a region compliant with the Turkish data protection law (KVKK). (cultural and political)
Decision: Three-tier (n-tier) client-server, on PaaS.
| Requirement | Design that meets it |
|---|---|
| O1 | Thin client: a web browser and a lightweight mobile app; turnstiles connect to the application tier through a REST API |
| P1, P2 | Several servers and a load balancer in the application tier; the database is redundant |
| P2 (turnstile) | A short offline mode at the turnstile: checking against the last synchronized member list |
| S1 | Payment is redirected to the external provider (EIF), the system stores only the transaction number |
| C1 | The cloud region is chosen appropriately; the database tier is reachable only from the application servers |
Deployment diagram
+------------------+ +-------------------+
| <<device>> | | <<device>> |
| Member phone | | Turnstile (IoT) |
| [fithub.apk] | | [gate-agent] |
+--------+---------+ +---------+---------+
| HTTPS | HTTPS
v v
+--------------------------------------------+
| <<execution env>> PaaS app tier (x3) |
| [fithub-api.jar] |
+--------------------+-----------------------+
| TCP (private network)
+--------------------v-----------------------+
| <<node>> Managed DB (primary + replica) |
+--------------------------------------------+
A node (a cube; here a box) is hardware or an execution environment, the things in square brackets are artifacts, and the arrows are communication paths.
Hardware and software specification
One of the outputs of design is a list of the resources to be bought or rented:
| Item | Minimum | Recommended |
|---|---|---|
| Application server | 2 virtual CPUs, 4 GB RAM | 3 instances, 4 virtual CPUs, 8 GB RAM, autoscaling |
| Database | Managed relational database, 50 GB | Primary + replica, daily backup |
| Client | Current browser / Android 10+, iOS 15+ | |
| Network | HTTPS, 50 Mbps at the branches | A backup mobile line at the branches |
| Software | Operating system, runtime, database licenses | A monitoring and logging tool |
The specification is sent to vendors; the offers are compared on price, performance, support and reliability. The whole cost is taken into account: license, installation, training, maintenance (total cost of ownership).
Common mistakes
| Wrong idea | The truth |
|---|---|
| A thin client runs the business logic | A thin client does only presentation |
| Two-tier = client + server, with the logic on the server | In two-tier the business logic is usually on the client (fat client) |
| In SaaS you manage the operating system | That is IaaS; in SaaS you only use the application |
| Cloud is always cheaper | The initial investment is low, it varies in the long run; there is a dependency risk |
| 99.9% = 8.76 minutes of downtime a year | 8.76 hours |
| For components in series, the availabilities are averaged | They are multiplied |
| Choose the architecture first and invent requirements later | Nonfunctional requirements determine the architecture |
| Drawing classes in a deployment diagram | Nodes, artifacts and connections are drawn |
Test yourself
Exam-style questions. Solve them on paper first, then reveal the answer.
Name the four basic functions of any application that the architecture distributes between client and server.
Show answer
Data storage: storing the data. Data access logic: the operations that access the data (SQL queries). Application logic: business rules. Presentation logic: displaying to the user and taking input. The type of architecture is determined by where these four run.
In a three-tier architecture, where does each part typically run?
Show answer
In two-tier, the client holds presentation + business logic and the server holds the data. In three-tier, the business logic moves to a separate application server. In n-tier the business logic is split across several servers (e.g. a web server + a payment service + a notification service).
Which statement about thin and thick clients is TRUE?
- A thin client runs most of the application logic
- A thick client runs only presentation logic
- A thin client (e.g., a web browser) runs little or no application logic
- Thin clients cannot use servers
Show answer
A thin client does only (or mostly) presentation, and the business logic is on the server. A thick (fat) client also runs most of the business logic. A thin client is easy to maintain: updates are made on the server.
Which architecture's main advantage is scalability, because servers can be added at each tier?
- Server-based (mainframe)
- Client-based
- Client-server (n-tier)
- Stand-alone desktop
Show answer
In client-server, when load grows, servers are added or strengthened (scale up / scale out). In a server-based architecture the single central server is a bottleneck and growing it is expensive. In a client-based architecture network traffic grows.
A startup uses a provider's database, runtime and OS, and only deploys its own code. Which cloud model is this?
- IaaS
- PaaS
- SaaS
- On-premises
Show answer
IaaS: virtual machines, storage, network; the operating system and everything above is yours. PaaS: the platform (runtime, database service) is provided, and you put your code on it. SaaS: you use a ready-made application (e-mail, CRM).
A system must have 99.9% availability. What is the maximum downtime per year (365 days)?
Show answer
A year has 365 × 24 = 8,760 hours. The downtime share is 0.1%: 8,760 × 0.001 = 8.76 hours (about 525.6 minutes).
Same question for 99.99% availability, in minutes per year.
Show answer
8,760 × 60 = 525,600 minutes. 0.01% of it: 525,600 × 0.0001 = 52.56 minutes. Each extra "9" cuts the downtime to one tenth and raises the cost considerably.
A web server with 99% availability and a database server with 99.5% availability are both required (in series). What is the overall availability?
Show answer
With components in series both must work, so the probabilities are multiplied: 0.99 × 0.995 = 0.98505 ≈ 98.5%. The total availability is lower than even the weakest component. That is why critical components are made redundant.
At peak time 2,000 users each send about 5 requests per minute. How many requests per second must the server handle?
Show answer
2,000 × 5 = 10,000 requests/minute. 10,000 / 60 = 166.67 ≈ 167 requests/second. In capacity planning a safety margin is added on top.
Classify: 'The app must be available in Turkish and English and follow KVKK rules.' Which nonfunctional category drives this, and what is one architecture consequence?
Show answer
Language support and legal compliance are cultural and political requirements. The effect on the architecture: in which country/region the data will be stored (choice of cloud region), multilingual interface support, an access log for personal data.
In a UML deployment diagram, what does a 3D box represent?
- A class
- A node (hardware or execution environment)
- A use case
- An artifact only
Show answer
In a deployment diagram, a node (a cube) is hardware or an execution environment (a server, a phone, a Docker container). An artifact (a software file: .jar, .apk) is placed inside a node. The line between nodes is a communication path (HTTPS, TCP).
Verification: Availability downtimes, the total availability of components in series, and requests per second were computed with node (verify/SEN2022/12.mjs). Conceptual questions were compared with the standard definitions of architecture types, cloud service models and nonfunctional requirement categories.