Client-Server Model

 Client-Server Model


Client-Server Model


 


What is the Client-Server Model?


⦁ In order to build database-backed web applications, we first need to understand how servers, clients, and databases interact.

⦁ A major part of this is the client-server model, so let's look at that first. The basic idea is very simple, and looks something like this:


client-server-model



⦁  A server is a centralized program that communicates over a network (such as the Internet) to serve clients.

⦁  And a client is a program (like the web browser on your computer) that can request data from a server.

⦁  When you go to a web page in your browser, your browser (the client) makes a request to the server—which then returns the data for that page.


Adding databases to the model :


Adding databases to the model


Relational Database Clients : 


⦁  A database client is any program that sends requests to a database.

⦁  In some cases, the database client is a webserver! When your browser makes a request, the web server acts as a server (fulfilling that request)

⦁  But when the web server requests data from the database, it is acting as a client to that database—and the database is the server (because it is fulfilling the request).



Servers, Clients, Hosts :


⦁  In a Client-Server Model, a server serves many clients.

⦁  The Client can be (Commands line Applications, Graphical users interfaces, Web App).


⦁  Servers and clients are programs that run on hosts.

⦁  The server sometimes refers to both the computer and the process that serves the web app


⦁  Hosts are computers connected over a network (like the internet!).

⦁  The host (computer) of the web server and the database, can be the same computer.


Requests and Responses :


⦁  A client sends a request to the server

⦁  The server's job is to fulfill the request with a response it sends back to the client.

⦁  Requests and responses are served via a communication protocol, which sets up the expectations and rules for how the communication occurs between servers and clients.


Client-Server Model



Note :

Don't let this confuse you. Basically, we call things clients when they are making a request and servers when they are fulfilling a request. 

Since a web server can do both, it sometimes acts as a server and sometimes acts as a client.


Comments

Popular posts from this blog

SQLAlchemy Model.query cheat-sheet

What is a DBAPI ?

Connections and Sessions in TCP/IP