Client-server architecture

Also known as: client-server model

On this page 7

Client-server architecture, also called the client-server model, is a software architecture in which programs are divided into clients that request services and servers that provide them, communicating over a network through a defined protocol. The server owns shared resources such as data, files or computation, and many clients use them without holding their own copy.

It is the foundation on which most networked software is built, from web browsing and email to databases and business applications. Many other styles in software architecture, including three-tier architecture and microservices, are refinements of the same basic idea: separate the party that asks from the party that answers, and connect them through an explicit interface.

How client-server communication works

The model is built on a request-response cycle. A client opens a connection, sends a request formatted according to a protocol such as HTTP, SQL over a database wire protocol or SMTP, and waits for the server to reply. The server listens on a known address and port, processes each request and returns a response containing data, a status or an error.

The roles are asymmetric. The client initiates; the server is passive until contacted, serves many clients at once and usually stays running continuously. This asymmetry lets the server act as a single point of control for data consistency, security policy and business rules, while clients focus on presentation and user interaction.

ComponentRoleTypical example
ClientInitiates requests and presents resultsWeb browser, mobile app, desktop application
ServerProcesses requests and owns resourcesWeb server, database server, mail server
ProtocolDefines message format and orderHTTP, SMTP, a database wire protocol
NetworkCarries messages between partiesLAN, internet, loopback on one host
Interface contractDescribes available operationsREST API, SQL schema, RPC definition
Core components of a client-server system

Client and server are roles, not machines. One process may be a server to its users and a client of a database at the same time, and both roles can run on the same computer.

Variants: thin clients, fat clients and tiers

Client-server systems differ mainly in where the work happens. A thin client does little more than display results and send input, leaving logic on the server; a fat client, or thick client, performs substantial processing and may cache data locally.

VariantLogic locationStrengthWeakness
Two-tierClient talks directly to a databaseSimple to buildHard to secure and scale
Three-tierPresentation, application and data tiersClear separation of concernsMore components to run
N-tierAdditional layers such as caches and gatewaysFlexible scalingHigher operational complexity
Thin clientMostly on the serverEasy central updatesDepends on network quality
Fat clientLargely on the clientResponsive and offline capableHarder to update and keep consistent
Main variants of the client-server model

Modern web applications blur the line: a single-page application runs significant logic in the browser, which makes it fairly fat, while still relying on server APIs for data and authorization.

Client-server compared with other architectures

Client-server describes how parties communicate, while many neighboring architectural terms describe how the server side is organized internally. That is why the model coexists with monolithic, service-oriented and microservices designs rather than competing with them.

StyleRelationship to client-serverMain difference
Peer-to-peerAlternative modelEvery node is both client and server
Three-tier architectureSpecialized formSplits the server side into two tiers
MicroservicesServer side built from many servicesServices also act as clients of each other
Event-driven architectureOften combinedAsynchronous events instead of direct requests
Monolithic architectureCommon server implementationOne deployable unit serves all requests
Client-server and related architectural styles

The key contrast is with peer-to-peer systems, where no node is privileged. Peer-to-peer removes the central bottleneck and single point of failure but makes consistency, trust and access control much harder to guarantee.

Designing and scaling client-server systems

Most design decisions in a client-server system concern state, scale and failure. A stateless server keeps no per-client memory between requests, so any instance can serve any request and capacity grows by adding instances behind a load balancer. A stateful server keeps sessions in memory, which is simpler at first but complicates scaling and failover.

Clients and networks are unreliable, so robust designs add timeouts, retries with backoff and idempotent operations that can be repeated safely. Caching on the client, in a content delivery network or in front of the database reduces load and latency, at the cost of possible stale data.

ChoiceBenefitTrade-off
Vertical scalingNo code changesHardware limit and single failure point
Horizontal scalingNear-linear capacity growthRequires stateless design
CachingLower latency and server loadInvalidation and stale data
Database replicationRead capacity and availabilityReplication lag and consistency issues
Common scaling choices and their trade-offs

Limitations and common pitfalls

The central server is both the strength and the main weakness of the model. If it fails or is overloaded, every client is affected, so production systems need redundancy, monitoring and capacity planning.

  • Chatty interfaces that need many round trips per screen make clients slow on high-latency networks.
  • Trusting the client is a classic security error: all validation and authorization must be repeated on the server.
  • Version skew between old clients and a new server breaks applications unless the API is versioned and backward compatible.
  • Tight coupling to one database schema in two-tier designs makes later changes expensive.

In everyday language

Client-server architecture works like a restaurant. Customers, the clients, look at the menu and place orders. The kitchen, the server, keeps the ingredients, cooks the food and sends it back. Customers never walk into the kitchen; they only use the agreed way of ordering.

Because one kitchen serves everyone, it can keep the food consistent and the ingredients safe. The trade-off is that if the kitchen is overwhelmed or closes, every table waits. That is why busy systems add more kitchens and a host who spreads the orders between them.

Seen in the real world

A regional chain of veterinary clinics replaces spreadsheets kept on each front-desk computer with a central client-server application. Reception staff use a web client in the browser, while a server cluster in a data center holds appointments, patient records and billing in one database.

The application servers are stateless and sit behind a load balancer, so the IT team adds a third instance during the busy vaccination season without downtime. All permission checks run on the server, so a staff member at one branch cannot open another branch’s billing data even by editing requests in the browser. The result is one consistent record per animal across all clinics instead of conflicting local copies.