Client-Server Architecture
Client-Server Architecture: Requests and Shared Authority
Client-server architecture organizes software around a service boundary. A client is a process that initiates requests for a service, while a server is a process that provides that service by handling requests and returning responses. You encounter this arrangement when an appointment application asks a booking service for available times. The architecture describes responsibilities and communication; it does not require one particular programming language, network, or physical machine.
Following one exchange
A client prepares a request containing an operation and the information needed to perform it. The server receives the request, interprets it, checks whether the operation is permitted, performs the necessary work, and returns a response. That response may contain requested data, confirmation of a change, or an explanation of failure.
The processes follow a protocol. Both sides need compatible expectations about message structure and meaning. Sending a correctly formatted request does not establish that the requested action is allowed.
Roles belong to an interaction. A service can receive a request as a server and then request help from another service as a client. Likewise, returning a response does not turn the original server into the client. The roles concern who requests and provides the service, rather than which direction a particular message travels.
Placing authority at the boundary
Clients commonly display information, collect input, and provide immediate feedback. The server handles decisions that depend on shared records or permissions. A client can preview whether an input looks acceptable, but the server must independently enforce rules that protect shared data.
For example, a stock display might become outdated before a customer submits an order. The server should check the stored stock when processing the purchase rather than accept the client's earlier display as proof of availability.
Responsibility | Client contribution | Server responsibility |
|---|---|---|
Input checking | Flag missing or malformed entries promptly | Check received input before using it |
Access control | Show actions appropriate to the interface | Verify permission for the requested operation |
Shared availability | Display the latest received information | Check and update the authoritative record |
Centralizing these decisions gives clients a common source of truth and allows service rules to change without embedding every rule in every interface. It also concentrates demand and creates a shared dependency: an unavailable or overloaded service can affect many clients.
Estimating time and processing capacity
For one exchange, measure response time from sending the request until receiving the complete response. A useful model is
Here, the two d terms are communication times, w is waiting time at the server, and s is server service time. This model excludes client work before sending and after receiving. Communication times include the relevant transfer delays, so do not add the same delay twice.
Example: A request takes 5 ms to reach the server, receives 8 ms of service without waiting, and takes 7 ms to return. Its response time is 20 ms.
If k independent workers each handle one request at a time with mean service time s seconds, the processing stage has an ideal capacity ceiling
For average incoming rate λ, the fraction of that processing capacity demanded is
These estimates assume the workers can operate independently. A shared resource or limited network link can impose a lower ceiling. Furthermore, average demand below a capacity ceiling does not guarantee short waiting times: bursts and variable service times still matter.
What to remember
- Identify roles by who requests and who provides the service.
- Enforce shared-data rules at the server boundary.
- Include communication, waiting, and service in response-time estimates.
- Treat calculated capacity as a ceiling under stated assumptions, not a guaranteed operating rate.
Example: Checking a Library Checkout Service
A library operates 36 checkout terminals. Each terminal sends an average of one checkout request every 3.00 s. A checkout service has three independent workers. Each request occupies one worker for 50.0 ms, including permission checks and loan-record updates. Assume workers can operate independently and no other resource limits processing capacity.
For one measured request, outward communication takes 12.0 ms, waiting at the service takes 20.0 ms, and return communication takes 18.0 ms. Client work outside this exchange is negligible.
a) Identify the requesting and service-providing processes. Where should the permission to borrow an item be enforced?
The software on each terminal acts as a client because it requests a checkout operation. The checkout service acts as the server because it handles the operation and returns a result.
The checkout service should enforce borrowing permissions using the current shared records. A terminal can give early feedback, but its local check cannot replace the service's authoritative check. The service should report success only according to the operation's defined completion rules.
b) Under the processing assumptions, is average demand below the service's capacity ceiling, and what percentage of that capacity does it demand?
First calculate the request rate, the number of incoming requests per unit time. One terminal contributes 1/3.00 requests per second. Across 36 terminals, the incoming rate is ________.
Next convert the service time: 50.0 ms is ________. Each worker can therefore process 1/0.0500=20.0 requests per second. With three independent workers, the ideal processing ceiling is ________.
The capacity utilization in this model is the fraction of the processing ceiling demanded by the incoming workload.
Average demand is below the processing ceiling and demands 20.0% of it. This leaves average processing headroom under the assumptions. It does not prove that every request avoids waiting, because arrivals may cluster.
c) Find the measured request's response time, from sending it to receiving the complete response.
First add the outward and return communication times. Their combined contribution is ________.
Next include both waiting and service at the server. Together these contribute ________.
Finally add the communication and server contributions, keeping all quantities in milliseconds.
The measured response time is 100.0 ms. Processing consumes only part of that interval. The measured waiting time is given separately; it was not inferred from the average utilization.
An engineering team is documenting communication between a reservation app and its server. Match each communication element to the description that best identifies its purpose.
Network location, such as a host name and port, used to contact the application providing the operation.
Communication reporting the outcome or returned data associated with an earlier operation.
Agreement specifying available operations, accepted inputs, returned outputs, and their meanings.
Communication asking for a particular operation and supplying the input data needed to perform it.
Response message
Request message
Service interface
Service address
An archive application first requests an access token from a server. Only after receiving the complete token response can it immediately send a document request to the same server. Every request journey and every response journey takes 15 ms. Server service takes 18 ms for the token request and 32 ms for the document request. There is no server waiting time, and all other client work is negligible.
Find the elapsed time from sending the token request until receiving the complete document response, in milliseconds, to the nearest whole millisecond.