Architecture: Client-server Model
Learning objectives
- You know what web application architecture means.
- You know what the client-server model is.
Web application architecture refers to the way how our applications are organized and how different parts of our applications interact with each others. Understanding basic web application architectures helps in discussing and reasoning about the applications.
The first architecture that we visit is the Client-server model (or client-server architecture), which is at the core of all web applications. In client-server model, a server is responsible for hosting and providing resources and services to one or more clients.
In practice, the client-server model is a distributed model where clients communicate with servers through a computer network such as the internet. When considering from the application point of view, clients are typically dependent on the servers -- clients ask for services or resources from servers. On the other hand, while servers share their resources, clients do not.
The HTTP protocol on which all of our web applications build is based on the client-server model. Each HTTP request is sent to a server, which processes the request and then provides a response. The request could ask for a resource such as a static image or a page, or, the request could ask for dynamically generated content that the server then would create based on the request.
The exact content that is being requested is, however, abstracted away in the HTTP protocol. When working with HTTP, each request is made to a path with a request method. The server then receives the request and determines how to respond based on the path and the request method -- the path and the request method often, if not always, map to specific functionality on the server.
Note that the a server can also act as a client. As an example, when a web server connects to a database server, the web server is a client, and the database server is the server.