Skip to main content

Command Palette

Search for a command to run...

#1 System Design: Web Protocols

Part 1 Welcome to the first series of the course :) #Foundations

Updated
6 min readView as Markdown
#1 System Design: Web Protocols
A

Backend Developer and a busy mom who loves technology and sharing knowledge that makes her fulfilling and happy

Blank diagram (7).jpeg

Teaser:

Just like our homes have addresses, computers have ip-addresses that are used to know where they are present in network(city).

If the USPS wants to deliver a package, they have procedures to send it to appropriate USPS facilities that's closest to the place where the package needs to be delivered. The mail person then delivers it to the correct address.

Thankfully we have a analogy to remember as how computers connect with each others in a network the same way how USPS operates ! :)

Application Layer

Provides applications with standards for data exchange. Protocols like HTTP,HTTP(S), FTP, Simple Mail Transfer Protocol and Simple Network Management Protocol are used at the application layer to initiate data transfer. The payload here is the actual data.

You are shopping for a product in amazon ! The HTTPS protocol will responsible of making your credit card information (data) secure so that only the amazon server can decrypt and understand.

There are many other protocols used for various other purposes as well. Check them out too :)

Screen Shot 2022-04-02 at 5.36.02 PM.png

How does TCP/IP work together ?

After all we live in a world full of computers, if they were all humans talking to each other from their seats(you are tied up to your seat) on a party hall, with voices crossing over each other. How crazy it might be !

I got a house recently might sound

I got a mouse recently :D

Yeah !! I get your feelings. Same way if computers did not have certain rules to communicate to each other, there is absolute chaos.

They decided to employ some rules like IP via the internet layer and TCP via the transport layer.

Protocol means rules !!!!

Screen Shot 2022-04-02 at 3.27.53 PM.png

What is an internet protocol?

Rules that computers follow to simply send data (talk) to each other is called Internet protocol.

Is there any other protocol they use? Just one???

Well, since IP is not that smart being single ;) it needed a company with smart TCP to do cool things. So in the below picture it let the TCP take the lead initially and will eventually follow through !!!

What exactly does it looks like if computers spoke to each other only using IP protocol?

An application that wants to send a large amount of data over the internet, if it used only IP, the data would have to be broken into multiple IP packets. This would require multiple requests to send and receive data, since IP requests are issued per packet.

With TCP, only a single request to send an entire data stream is needed

TCP handles the rest. Unlike IP, TCP can detect problems that arise in IP and request retransmission of any data packets that were lost.

TCP can also reorganize packets so they get transmitted in the proper order -- and it can minimize network congestion.

TCP/IP are best buddies you see ! making data transfers over the internet easier. Let's see their best in action below :)

Screen Shot 2022-04-02 at 4.35.05 PM.png

I kinda of heard these buzz words but how does it all fit in???

I'll stick around a bit more now....

TCP/IP Protocol:

WebProtocols.jpeg

Internet Layer/Network Layer

Internet layer connects all computers out there in the world via Internet protocol, when a computer wants to send a data to another computer it chops the data into packets and sends it via its router to the computer on the other end of the world.

But sometimes these packets can get lost... Sigh !!!.. so they wanted to be sure that the packets they sent reached the other side in the order the sender has sent it.

That's exactly what TCP Transmission Control Protocol is for.

Transport Layer:

It provides flow control by establishing connections between the client and the server and assembles the packets it received so its in the order the sender has sent.

Now we call it as "stateful" because it has context as part of the TCP segment ("packaged" segments of the data stream including a TCP header).

It also means detect errors(either lost or out of order packets) and request re-transmission.

TCP protocol was built with an emphasis on accuracy, so it's best used in applications where accuracy is more important than speed of delivery.

Snack bite:

telnet mailserver.server.com 25

This would establish a TCP connection on port 25.

UDP (User Datagram Protocol)

This is similar to what my mom tells my brother

I don't bother what you think about doing school homework, Just take it and do it!!..

Screen Shot 2022-04-02 at 4.47.01 PM.png

Ha ha ha ..

Mom(sender) doesn't care what is the reaction the otherside and keeps sending data(assignments) even if its offline(Sad brother who wants to play instead, snoozed) :).

UDP is a simpler alternative to TCP that also works with the IP protocol to transmit data. It's connectionless, making it much faster than TCP, but because it has none of the error-handling capabilities of TCP, it's error-prone. UDP is mainly used for streaming applications such as Skype, where users accept occasional delays in exchange for real-time service.

Packets may arrive out of order, or even could go missing, but sender would not need to know all of that.

Together, TCP and UDP make up most internet traffic at the Transport Layer.

The history of TCP/IP

The Defense Advanced Research Projects Agency, the research branch of the U.S. Department of Defense, created the TCP/IP model in the 1970s for use in ARPANET, a wide area network that preceded the internet. TCP/IP was originally designed for the Unix OS, and it has been built into all of the OSes that came after it.

The TCP/IP model and its related protocols are now maintained by the Internet Engineering Task Force.

TCP vs UDP

TCP emphasizes accurate delivery rather than speed and enforces the "rules of the road", similar to a traffic cop.

you don't want a speeding ticket for sure !!!! Just follow the rules and drive safely.

It's connection-oriented, which means that the server must be "listening" for connection requests from clients, and the client and server must be connected before any data is sent.

Because it's a stateful protocol, context is embedded into the TCP segment ("packaged" segments of the data stream including a TCP header), meaning that TCP can detect errors (either lost or out-of-order data packets) and request re-transmission.

Speeding Cameras are watching you. If you speed or lose yourself on wheel, you'll likely be asked to pay back the penalty !

UDP is connectionless !!!! Unlimited racing.... but remember errors can happen and there is none to help !!!

Screen Shot 2022-04-02 at 4.44.01 PM.png

More from this blog

D

Dev Blossoms

18 posts

Transforming my "Learning Journeys" into a sharing platform is not just fulfilling, its way to inspire others to rise and unwind their obstacles. Know Everyone has been there :)