Client Side vs Server Side : A Comprehensive Guide for Beginners

Client Side vs Server Side : A Comprehensive Guide for Beginners

Introduction

Client-Server Architecture is a modern computing model that divides tasks between to main entities — Servers and Clients. They communicate over a network to perform any kind of tasks or sharing information between each other. Nowadays it is widely used in modern computing like web applications and email services.

Casts : Key Components

In this story, there are two main casts:

  1. Client : Mr. Client is an enquirer. He always ask different type of queries as requests. But there is a twist. He don’t have a body so he always uses someone else to make his requests. Sometimes he is in browser and sometimes may be in email apps.

  2. Server: Mrs. Server is a giver. She is very rich with a currency called Data. You can imagine her richness by the fact that whatever you search from internet, it comes from the heart of Mrs. Server. She always gives responses to every query. If server has not the answer then also she will not let you go back empty hands, 404.

The Love Story : How Client-Server Works

Now we will know how client and server works with each other. A little story of romance and drama:

Just imagine Client and Server was living in a house as a couple. One day Mrs. Server was coming down on stares and got slipped. She got some problem in their brain. Now she cant remember anything for long time. Whenever Mr. Client need something, he has to give his information about himself and requests. After that Mr. Server responds with the relevant answer.

If she has the answer then said 200 or if don’t she just said 404.

From here we will get Request-Response Model —

A user interacts with the client side on a browser or mobile application and he sends a request of GET / POST / UPDATE or anything to do. The server respond by searching the relevant answers in her database.

As we know that Mrs. Server has some brain problem so she does a verification kind of thing to know the person who is asking for the data is Mr. Client or someone else. Her verification process is name TCP (Transmission Control Protocol) Handshake.

Browser is also a good guy so he save the responded data as cache in his local memory otherwise Mr. Client will have to do always the TCP Handshake.

Relationship Drama : Types of Client-Server Architecture

In this section we will look at the relationship between Client and Server. In this section lets assume that Client and Server is opening a shop and serving users.

  1. Couple : Two-Tier Architecture

In two tier architecture there is no middle man. Mr. Client as a PC directs meets Mrs. Server as database. No Confusion, Only Love. Whatever user asks the client provides from the server’s database.

  1. First Kid : Three-Tier Architecture

Here you will get a little bit twist. Now there is one more person in the story who applies logic. Mr. Client has been old. Now he only gives order and the logic is applied by his son.

Yeah you heard it right.

One whose front-end is awesome. He is the face of the brand known as Presentation Logic.

Another one who applies all the logic in the front-end, known as Application Logic. He has a beast brain.

The last our Mrs. Server who provides the data based on their responses.

  1. Employees : N - Tier Architecture

Now Mr. Client is being ambitious and he wants to serve more users. So he started employing more and more people to fulfill users demand as fast as possible. There is new Cloud based Applications with Microservices, Database Servers and Caching Servers.

Advantages of this Relationship

  1. Centralized Management : The client-server architecture is easy to maintenance and very secured because in this architecture things are less messy.

  2. Scalability : Client-Server architecture is scalable by its nature. Whenever we want we can add more clients and servers and scale it as per our needs.

Disadvantages of this Relationship

  1. Server Dependency : Client-Server architecture is a server dependent architecture. If the server crashes many clients will be affected on same time.

  2. Network latency : If lots of users started request at same time on a server then there is a big chance that the server will start responding slow if the network is weak.

Real-World Example: Online Shopping Website

  1. Client : Lets assume a user opens a web browser and opens an online shopping website e.g. amazon.com. The browser will send a request to amazon’s web server.

  2. Server Processing: After receiving the request the web server will process it and will communicate with database to fetch product details, user cart etc.

  3. Response Back: Then the server send all the details e.g. product images, reviews, description etc. to the client and the browser renders the HTML page on screen.

Conclusion

In this blog we discussed about what is a client-server architecture and how it works. To conclude we can say that it mainly works on request-response model. It has mainly three types:

  • Two-Tier Architecture

  • Three-Tier Architecture

  • N-Tier Architecture

Hope you liked the blog. Please press the like button to encourage me and click the follow button to get lates update about these blogs.